Skip to content

Commit

Permalink
[Php56] Reduce origNode check on UndefinedVariableResolver (#4033)
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed May 30, 2023
1 parent 73c1ac4 commit b84fe95
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions rules/Php56/NodeAnalyzer/UndefinedVariableResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,22 +57,14 @@ public function resolve(ClassMethod | Function_ | Closure $node): array
): ?int {
// entering new scope - break!
if ($node instanceof FunctionLike && ! $node instanceof ArrowFunction) {
return NodeTraverser::STOP_TRAVERSAL;
return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN;
}

if ($node instanceof Foreach_) {
// handled above
return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN;
}

/**
* The Node that doesn't have origNode attribute yet
* means the Node is a replacement below other changed node
*/
if (! $node->hasAttribute(AttributeKey::ORIGINAL_NODE)) {
return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN;
}

if (! $node instanceof Variable) {
return null;
}
Expand Down

0 comments on commit b84fe95

Please sign in to comment.