-
-
Notifications
You must be signed in to change notification settings - Fork 374
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve ParentClassMethodTypeOverrideGuard performance #3660
Conversation
@@ -37,14 +37,20 @@ public function getParentClassMethod(ClassMethod $classMethod): ?MethodReflectio | |||
|
|||
/** @var string $methodName */ | |||
$methodName = $this->nodeNameResolver->getName($classMethod); | |||
$parentClassReflections = array_merge($classReflection->getParents(), $classReflection->getInterfaces()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
before this change the whole type hierarchy had to be reflected which can be costly.
with this PR we only reflect what on level at a time
@@ -37,14 +37,20 @@ public function getParentClassMethod(ClassMethod $classMethod): ?MethodReflectio | |||
|
|||
/** @var string $methodName */ | |||
$methodName = $this->nodeNameResolver->getName($classMethod); | |||
$parentClassReflections = array_merge($classReflection->getParents(), $classReflection->getInterfaces()); | |||
$parentClassReflection = $classReflection->getParentClass(); | |||
while ($parentClassReflection !== null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be instanceof check. I'll make a note to make Rector rule to cover these :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed, thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thank you @staabm
* Improve ParentClassMethodTypeOverrideGuard performance * use instanceof
No description provided.