Skip to content

Commit

Permalink
[Core] Move parent instanceof Node check on BetterNodeFinder::findPar…
Browse files Browse the repository at this point in the history
…entType() inside do { } while condition (#2190)

* [Core] Remove parent instanceof Node check on BetterNodeFinder::findParentType()

* fix
  • Loading branch information
samsonasik committed Apr 28, 2022
1 parent 8332d8c commit c411410
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/PhpParser/Node/BetterNodeFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,8 @@ public function findParentType(Node $node, string $type): ?Node
return $parent;
}

if (! $parent instanceof Node) {
return null;
}
} while ($parent = $parent->getAttribute(AttributeKey::PARENT_NODE));
$parent = $parent->getAttribute(AttributeKey::PARENT_NODE);
} while ($parent instanceof Node);

return null;
}
Expand Down

0 comments on commit c411410

Please sign in to comment.