Skip to content

Commit

Permalink
Merge pull request #2885 from rectorphp/fix-const
Browse files Browse the repository at this point in the history
Fix already constant
  • Loading branch information
TomasVotruba authored Feb 19, 2020
2 parents d7fcfe1 + 9da97ed commit 5a3b0ad
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "0.6-dev"
"dev-master": "0.8-dev"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,13 @@ private function refactorClassMethod(ClassMethod $classMethod, Class_ $class, ar
foreach ($readOnlyVariableAssigns as $readOnlyVariableAssign) {
$this->removeNode($readOnlyVariableAssign);

/** @var Variable $variable */
/** @var Variable|ClassConstFetch $variable */
$variable = $readOnlyVariableAssign->var;
// already overriden
if (! $variable instanceof Variable) {
continue;
}

$classConst = $this->createClassConst($variable, $readOnlyVariableAssign->expr);

// replace $variable usage in the code with constant
Expand Down

0 comments on commit 5a3b0ad

Please sign in to comment.