Skip to content

Commit

Permalink
NodeNameResolver: faster isNames() (#5004)
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm committed Sep 12, 2023
1 parent aeba96a commit 09baf7d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/NodeNameResolver/NodeNameResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,13 @@ public function __construct(
*/
public function isNames(Node $node, array $names): bool
{
$nodeName = $this->getName($node);
if ($nodeName === null) {
return false;
}

foreach ($names as $name) {
if ($this->isName($node, $name)) {
if ($this->isStringName($nodeName, $name)) {
return true;
}
}
Expand Down

0 comments on commit 09baf7d

Please sign in to comment.