Skip to content

Commit

Permalink
[CodeQuality][Performance] Using STOP_TRAVERSAL in traverseNodesWithC…
Browse files Browse the repository at this point in the history
…allable() in LocallyCalledStaticMethodToNonStaticRector (#4278)
  • Loading branch information
samsonasik committed Jun 18, 2023
1 parent 33cfa4f commit c8e7963
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use PhpParser\Node\Expr\Variable;
use PhpParser\Node\Stmt\Class_;
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\NodeTraverser;
use PHPStan\Reflection\ClassReflection;
use Rector\Core\Rector\AbstractRector;
use Rector\Core\Reflection\ReflectionResolver;
Expand Down Expand Up @@ -164,7 +165,7 @@ private function isClassMethodCalledInAnotherStaticClassMethod(Class_ $class, Cl
$this->traverseNodesWithCallable($checkedClassMethod, function (Node $node) use (
$currentClassMethodName,
&$isInsideStaticClassMethod
): ?StaticCall {
): ?int {
if (! $node instanceof StaticCall) {
return null;
}
Expand All @@ -178,7 +179,7 @@ private function isClassMethodCalledInAnotherStaticClassMethod(Class_ $class, Cl
}

$isInsideStaticClassMethod = true;
return $node;
return NodeTraverser::STOP_TRAVERSAL;
});

if ($isInsideStaticClassMethod) {
Expand Down

0 comments on commit c8e7963

Please sign in to comment.