Skip to content

Commit e488862

Browse files
authored
Update ContainerBindConcreteWithClosureOnlyRector Rule
Prevent changes when the abstract class is a variable.
1 parent 7e07220 commit e488862

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Rector/MethodCall/ContainerBindConcreteWithClosureOnlyRector.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace RectorLaravel\Rector\MethodCall;
44

55
use PhpParser\Node;
6+
use PhpParser\Node\Expr\Variable;
67
use PhpParser\Node\Const_;
78
use PhpParser\Node\Expr\Closure;
89
use PhpParser\Node\Expr\MethodCall;
@@ -74,6 +75,10 @@ public function refactor(Node $node): ?MethodCall
7475
$classString = $node->getArgs()[0]->value;
7576
$concreteNode = $node->getArgs()[1]->value;
7677

78+
if ($classString instanceof Node\Expr\Variable) {
79+
return null;
80+
}
81+
7782
if (! $concreteNode instanceof Closure) {
7883
return null;
7984
}

0 commit comments

Comments
 (0)