private function convertVariablesToInstanceVariables() { $definedVariables = $this->getDefinedVariables(); if (!$definedVariables->contains($this->convertVariable)) { throw RefactoringException::variableNotInRange($this->convertVariable, $selectedMethodLineRange); } $this->session->addEdit(new LocalVariableToInstance($definedVariables, $this->convertVariable)); }
private function renameLocalVariable() { $definedVariables = $this->getDefinedVariables(); if (!$definedVariables->contains($this->oldName)) { throw RefactoringException::variableNotInRange($this->oldName, $selectedMethodLineRange); } $this->session->addEdit(new RenameVariable($definedVariables, $this->oldName, $this->newName)); }
protected function assertIsInsideMethod() { if (!$this->codeAnalysis->isInsideMethod($this->file, LineRange::fromSingleLine($this->line))) { throw RefactoringException::rangeIsNotInsideMethod(LineRange::fromSingleLine($this->line)); } }
protected function assertIsInsideMethod() { if (!$this->codeAnalysis->isInsideMethod($this->file, $this->extractRange)) { throw RefactoringException::rangeIsNotInsideMethod($this->extractRange); } }