Skip to content

Commit

Permalink
Check for ClassLike instance in PropertyFetchFinder (#1033)
Browse files Browse the repository at this point in the history
  • Loading branch information
canvural committed Oct 21, 2021
1 parent 4c3de12 commit 1f2a4e9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/PhpParser/NodeFinder/PropertyFetchFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ private function findPropertyFetchesInNonAnonymousClassLike(array $nodes, string

foreach ($propertyFetches as $key => $propertyFetch) {
$currentClassLike = $propertyFetch->getAttribute(AttributeKey::CLASS_NODE);

if (! $currentClassLike instanceof \PhpParser\Node\Stmt\ClassLike) {
continue;
}

if ($this->classAnalyzer->isAnonymousClass($currentClassLike)) {
unset($propertyFetches[$key]);
}
Expand Down

0 comments on commit 1f2a4e9

Please sign in to comment.