77use PhpParser \Node ;
88use PhpParser \Node \Expr \Array_ ;
99use PhpParser \Node \Expr \ClassConstFetch ;
10- use PhpParser \Node \Expr \Closure ;
1110use PhpParser \Node \Expr \MethodCall ;
1211use PhpParser \Node \Expr \PropertyFetch ;
1312use PhpParser \Node \Expr \StaticCall ;
1413use PhpParser \Node \Expr \Variable ;
1514use PhpParser \Node \VariadicPlaceholder ;
16- use PhpParser \NodeVisitor ;
1715use PHPStan \Analyser \Scope ;
1816use PHPStan \Reflection \ClassReflection ;
1917use PHPStan \Reflection \ReflectionProvider ;
2422use Rector \Rector \AbstractRector ;
2523use Rector \Reflection \ReflectionResolver ;
2624use Rector \StaticTypeMapper \ValueObject \Type \FullyQualifiedObjectType ;
27- use Rector \Symfony \NodeAnalyzer \SymfonyPhpClosureDetector ;
2825use Rector \ValueObject \PhpVersion ;
2926use Rector \VersionBonding \Contract \MinPhpVersionInterface ;
3027use Symplify \RuleDocGenerator \ValueObject \CodeSample \CodeSample ;
@@ -40,7 +37,6 @@ public function __construct(
4037 private readonly ArrayCallableMethodMatcher $ arrayCallableMethodMatcher ,
4138 private readonly ReflectionProvider $ reflectionProvider ,
4239 private readonly ReflectionResolver $ reflectionResolver ,
43- private readonly SymfonyPhpClosureDetector $ symfonyPhpClosureDetector
4440 ) {
4541 }
4642
@@ -85,20 +81,15 @@ public function name()
8581 */
8682 public function getNodeTypes (): array
8783 {
88- return [Array_::class, Closure::class ];
84+ return [Array_::class];
8985 }
9086
9187 /**
92- * @param Array_|Closure $node
93- * @return StaticCall|MethodCall|null|NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN
88+ * @param Array_ $node
9489 */
95- public function refactor (Node $ node ): StaticCall |MethodCall |null | int
90+ public function refactor (Node $ node ): StaticCall |MethodCall |null
9691 {
97- if ($ node instanceof Closure) {
98- if ($ this ->symfonyPhpClosureDetector ->detect ($ node )) {
99- return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN ;
100- }
101-
92+ if ($ node ->getAttribute (AttributeKey::IS_INSIDE_SYMFONY_PHP_CLOSURE )) {
10293 return null ;
10394 }
10495
0 commit comments