Skip to content

Commit

Permalink
Improve PropertyFetchAnalyzer performance (#3654)
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm committed Apr 22, 2023
1 parent f26a476 commit d490fe5
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/NodeAnalyzer/PropertyFetchAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,15 @@ public function isLocalPropertyFetch(Node $node): bool

public function isLocalPropertyFetchName(Node $node, string $desiredPropertyName): bool
{
if (! $this->isLocalPropertyFetch($node)) {
if (! $node instanceof PropertyFetch && ! $node instanceof StaticPropertyFetch) {
return false;
}

if (!$this->nodeNameResolver->isName($node->name, $desiredPropertyName)) {
return false;
}

/** @var PropertyFetch|StaticPropertyFetch $node */
return $this->nodeNameResolver->isName($node->name, $desiredPropertyName);
return $this->isLocalPropertyFetch($node);
}

public function countLocalPropertyFetchName(Class_ $class, string $propertyName): int
Expand Down

0 comments on commit d490fe5

Please sign in to comment.