Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm committed Jul 19, 2024
1 parent 577a168 commit 39364aa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
7 changes: 6 additions & 1 deletion src/Collectors/PublicPropertyFetchCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,12 @@ public function processNode(Node $node, Scope $scope): ?array
$propertyFetcherType = $scope->getType($node->var);
foreach($propertyFetcherType->getObjectClassReflections() as $classReflection) {
$propertyName = $node->name->toString();
$result[] = $classReflection->getName() . '::' . $propertyName;

if (!$classReflection->hasProperty($propertyName)) {
continue;
}
$propertyReflection = $classReflection->getProperty($propertyName, $scope);
$result[] = $propertyReflection->getDeclaringClass()->getName() . '::' . $propertyName;
}

return $result;
Expand Down
9 changes: 7 additions & 2 deletions src/Collectors/PublicStaticPropertyFetchCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,14 @@ public function processNode(Node $node, Scope $scope): ?array
$classType = $scope->getType($node->class);
}
$result = [];
foreach($classType->getObjectClassNames() as $className) {
foreach($classType->getObjectClassReflections() as $classReflection) {
$propertyName = $node->name->toString();
$result[] = $className . '::' . $propertyName;

if (!$classReflection->hasProperty($propertyName)) {
continue;
}
$propertyReflection = $classReflection->getProperty($propertyName, $scope);
$result[] = $propertyReflection->getDeclaringClass()->getName() . '::' . $propertyName;
}

return $result;
Expand Down

0 comments on commit 39364aa

Please sign in to comment.