File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 44
55namespace Rector \Rector ;
66
7- use PhpParser \Builder \FunctionLike ;
87use PhpParser \Node ;
8+ use PhpParser \Node \FunctionLike ;
99use PhpParser \Node \Name ;
1010use PhpParser \Node \PropertyItem ;
1111use PhpParser \Node \Stmt \Class_ ;
@@ -310,13 +310,18 @@ private function decorateCurrentAndChildren(Node $node): void
310310 static fn (string $ nodeType ): bool => $ nodeType !== $ node ::class
311311 );
312312
313- $ this ->traverseNodesWithCallable ($ node , static function (Node $ subNode ) use ($ otherTypes ): int |Node {
313+ $ this ->traverseNodesWithCallable ($ node , static function (Node $ subNode ) use ($ node , $ otherTypes ): null | int |Node {
314314 // early check here as included in other types defined in getNodeTypes()
315315 if (in_array ($ subNode ::class, $ otherTypes , true )) {
316316 $ subNode ->setAttribute (AttributeKey::SKIPPED_BY_RECTOR_RULE , static ::class);
317317 return $ subNode ;
318318 }
319319
320+ // already set
321+ if ($ node === $ subNode ) {
322+ return null ;
323+ }
324+
320325 // inner class/function are out of scope
321326 if ($ subNode instanceof Class_ || $ subNode instanceof FunctionLike) {
322327 return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN ;
You can’t perform that action at this time.
0 commit comments