/**
  * @return int[]
  */
 private function getLinesVariableIsUsedOn()
 {
     $variables = $this->definedVars->all();
     $variableName = $this->oldName->getName();
     $lines = array();
     if (isset($variables[$variableName])) {
         $lines = $variables[$variableName];
     }
     return $lines;
 }
 /**
  * Does list contain the given variable?
  *
  * @return bool
  */
 public function contains(Variable $variable)
 {
     return isset($this->readAccess[$variable->getName()]) || isset($this->changeAccess[$variable->getName()]);
 }
 private function addProperty()
 {
     $line = $this->codeAnalysis->getLineOfLastPropertyDefinedInScope($this->file, $this->line);
     $this->session->addEdit(new AddProperty($line, $this->convertVariable->getName()));
 }
 public function performEdit(EditorBuffer $buffer)
 {
     $renamer = new RenameVariable($this->definedVars, $this->variable, $this->variable->convertToInstance());
     $renamer->performEdit($buffer);
 }
 private function assertVariableIsLocal(Variable $variable)
 {
     if (!$variable->isLocal()) {
         throw RefactoringException::variableNotLocal($variable);
     }
 }
 public static function variableNotLocal(Variable $variable)
 {
     return new self(sprintf('Given variable "%s" is required to be local to the current method.', $variable->getToken()));
 }