diff --git a/rules/Php56/NodeAnalyzer/UndefinedVariableResolver.php b/rules/Php56/NodeAnalyzer/UndefinedVariableResolver.php index b68ef68c19c..ee9c6381991 100644 --- a/rules/Php56/NodeAnalyzer/UndefinedVariableResolver.php +++ b/rules/Php56/NodeAnalyzer/UndefinedVariableResolver.php @@ -146,10 +146,6 @@ private function shouldSkipVariable(Variable $variable, Node $parentNode): bool return true; } - if ($this->variableAnalyzer->isStaticOrGlobal($variable)) { - return true; - } - if ($this->isAssign($parentNode)) { return true; } @@ -163,10 +159,6 @@ private function shouldSkipVariable(Variable $variable, Node $parentNode): bool return true; } - if ($this->isDifferentWithOriginalNodeOrNoScope($variable)) { - return true; - } - $variableName = $this->nodeNameResolver->getName($variable); // skip $this, as probably in outer scope @@ -178,6 +170,14 @@ private function shouldSkipVariable(Variable $variable, Node $parentNode): bool return true; } + if ($this->isDifferentWithOriginalNodeOrNoScope($variable)) { + return true; + } + + if ($this->variableAnalyzer->isStaticOrGlobal($variable)) { + return true; + } + if ($this->hasPreviousCheckedWithIsset($variable)) { return true; }