Skip to content

Commit

Permalink
Improve ReflectionResolver performance (#3658)
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm authored and samsonasik committed May 8, 2023
1 parent 6456123 commit a309aa6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Reflection/ReflectionResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,11 @@ public function resolveMethodReflectionFromNew(New_ $new): ?MethodReflection
public function resolvePropertyReflectionFromPropertyFetch(
PropertyFetch | StaticPropertyFetch $propertyFetch
): ?PhpPropertyReflection {
$propertyName = $this->nodeNameResolver->getName($propertyFetch->name);
if ($propertyName === null) {
return null;
}

$fetcheeType = $propertyFetch instanceof PropertyFetch
? $this->nodeTypeResolver->getType($propertyFetch->var)
: $this->nodeTypeResolver->getType($propertyFetch->class);
Expand All @@ -233,11 +238,6 @@ public function resolvePropertyReflectionFromPropertyFetch(

$classReflection = $this->reflectionProvider->getClass($fetcheeType->getClassName());

$propertyName = $this->nodeNameResolver->getName($propertyFetch->name);
if ($propertyName === null) {
return null;
}

if (! $classReflection->hasProperty($propertyName)) {
return null;
}
Expand Down

0 comments on commit a309aa6

Please sign in to comment.