From 6374ccddd0facb7e8678a27c47e6749b0b02b3fe Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Sat, 22 Apr 2023 17:55:56 +0200 Subject: [PATCH] Improve LocalMethodCallFinder performance (#3651) --- src/PhpParser/NodeFinder/LocalMethodCallFinder.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/PhpParser/NodeFinder/LocalMethodCallFinder.php b/src/PhpParser/NodeFinder/LocalMethodCallFinder.php index 4c7af831a08..72b44c91313 100644 --- a/src/PhpParser/NodeFinder/LocalMethodCallFinder.php +++ b/src/PhpParser/NodeFinder/LocalMethodCallFinder.php @@ -44,16 +44,16 @@ public function match(ClassMethod $classMethod): array $matchingMethodCalls = []; foreach ($methodCalls as $methodCall) { - $callerType = $this->nodeTypeResolver->getType($methodCall->var); - if (! $callerType instanceof TypeWithClassName) { + if (! $this->nodeNameResolver->isName($methodCall->name, $classMethodName)) { continue; } - if ($callerType->getClassName() !== $className) { + $callerType = $this->nodeTypeResolver->getType($methodCall->var); + if (! $callerType instanceof TypeWithClassName) { continue; } - if (! $this->nodeNameResolver->isName($methodCall->name, $classMethodName)) { + if ($callerType->getClassName() !== $className) { continue; }