File tree Expand file tree Collapse file tree 2 files changed +20
-15
lines changed
Expand file tree Collapse file tree 2 files changed +20
-15
lines changed Original file line number Diff line number Diff line change 2525
2626final class NodeAttributeReIndexer
2727{
28- private static function reIndexStmtsKeys (Node $ node ): ?Node
29- {
30- if (! $ node instanceof StmtsAwareInterface && ! $ node instanceof ClassLike && ! $ node instanceof Declare_ && ! $ node instanceof Block) {
31- return null ;
32- }
33-
34- if ($ node ->stmts === null ) {
35- return null ;
36- }
37-
38- $ node ->stmts = array_values ($ node ->stmts );
39-
40- return $ node ;
41- }
42-
4328 public static function reIndexNodeAttributes (Node $ node ): ?Node
4429 {
4530 self ::reIndexStmtsKeys ($ node );
@@ -78,4 +63,19 @@ public static function reIndexNodeAttributes(Node $node): ?Node
7863
7964 return null ;
8065 }
66+
67+ private static function reIndexStmtsKeys (Node $ node ): ?Node
68+ {
69+ if (! $ node instanceof StmtsAwareInterface && ! $ node instanceof ClassLike && ! $ node instanceof Declare_ && ! $ node instanceof Block) {
70+ return null ;
71+ }
72+
73+ if ($ node ->stmts === null ) {
74+ return null ;
75+ }
76+
77+ $ node ->stmts = array_values ($ node ->stmts );
78+
79+ return $ node ;
80+ }
8181}
Original file line number Diff line number Diff line change @@ -196,6 +196,11 @@ final public function leaveNode(Node $node): array|int|Node|null
196196 return null ;
197197 }
198198
199+ // nothing to change here
200+ if ($ this ->toBeRemovedNodeId === null && $ this ->nodesToReturn === []) {
201+ return null ;
202+ }
203+
199204 $ objectId = spl_object_id ($ node );
200205 if ($ this ->toBeRemovedNodeId === $ objectId ) {
201206 $ this ->toBeRemovedNodeId = null ;
You can’t perform that action at this time.
0 commit comments