Skip to content

Commit 28fde1a

Browse files
committed
Fix
1 parent 956294f commit 28fde1a

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

rules/CodeQuality/Rector/FuncCall/AssertFuncCallToPHPUnitAssertRector.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use PhpParser\Node\Expr\StaticCall;
2020
use PhpParser\Node\Expr\Variable;
2121
use PhpParser\Node\Name\FullyQualified;
22+
use PhpParser\Node\Stmt\ClassMethod;
2223
use PhpParser\NodeVisitor;
2324
use PHPStan\Reflection\ClassReflection;
2425
use Rector\PhpParser\Node\Value\ValueResolver;
@@ -78,15 +79,23 @@ public function test()
7879
*/
7980
public function getNodeTypes(): array
8081
{
81-
return [Closure::class, FuncCall::class];
82+
return [ClassMethod::class, Closure::class, FuncCall::class];
8283
}
8384

8485
/**
85-
* @param Closure|FuncCall $node
86+
* @param ClassMethod|Closure|FuncCall $node
8687
* @return StaticCall|MethodCall|null|NodeVisitor::DONT_TRAVERSE_CHILDREN
8788
*/
8889
public function refactor(Node $node): StaticCall|MethodCall|null|int
8990
{
91+
if ($node instanceof ClassMethod) {
92+
if ($node->isStatic()) {
93+
return NodeVisitor::DONT_TRAVERSE_CHILDREN;
94+
}
95+
96+
return null;
97+
}
98+
9099
if ($node instanceof Closure) {
91100
if ($node->static) {
92101
return NodeVisitor::DONT_TRAVERSE_CHILDREN;

0 commit comments

Comments
 (0)