@@ -142,7 +142,6 @@ private function traverseNode(Node $node): void
142142 continue ;
143143 }
144144
145- $ traverseChildren = true ;
146145 $ currentNodeVisitors = $ this ->getVisitorsForNode ($ subNode );
147146
148147 foreach ($ currentNodeVisitors as $ currentNodeVisitor ) {
@@ -162,29 +161,17 @@ private function traverseNode(Node $node): void
162161 // stop traversing as node type changed and visitors won't work
163162 continue 2 ;
164163 }
165-
166- // } elseif ($return === NodeVisitor::DONT_TRAVERSE_CHILDREN) {
167- // $traverseChildren = false;
168- // } elseif ($return === NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN) {
169- // $traverseChildren = false;
170- // break;
171- // } elseif ($return === NodeVisitor::STOP_TRAVERSAL) {
172- // $this->stopTraversal = true;
173- // break 2;
174- // } elseif ($return === NodeVisitor::REPLACE_WITH_NULL) {
175- // $node->{$name} = null;
176- // continue 2;
177164 } else {
178165 throw new LogicException ('RectorRunner::run() returned invalid value of type ' . gettype ($ return ));
179166 }
180167 }
181168
182- if ($ traverseChildren ) {
183- $ this ->traverseNode ($ subNode );
184- if ($ this ->stopTraversal ) {
185- break ;
186- }
169+ // if ($traverseChildren) {
170+ $ this ->traverseNode ($ subNode );
171+ if ($ this ->stopTraversal ) {
172+ break ;
187173 }
174+ // }
188175 }
189176 }
190177
@@ -225,29 +212,15 @@ private function traverseArray(array $nodes): array
225212 } elseif ($ return === NodeVisitor::REMOVE_NODE ) {
226213 $ doNodes [] = [$ i , []];
227214 continue 2 ;
228- } elseif ($ return === NodeVisitor::DONT_TRAVERSE_CHILDREN ) {
229- $ traverseChildren = false ;
230- } elseif ($ return === NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN ) {
231- $ traverseChildren = false ;
232- break ;
233- } elseif ($ return === NodeVisitor::STOP_TRAVERSAL ) {
234- $ this ->stopTraversal = true ;
235- break 2 ;
236- } elseif ($ return === NodeVisitor::REPLACE_WITH_NULL ) {
237- throw new LogicException (
238- 'REPLACE_WITH_NULL can not be used if the parent structure is an array '
239- );
240215 } else {
241216 throw new LogicException ('RectorRunner::run() returned invalid value of type ' . gettype ($ return ));
242217 }
243218 }
244219 }
245220
246- if ($ traverseChildren ) {
247- $ this ->traverseNode ($ node );
248- if ($ this ->stopTraversal ) {
249- break ;
250- }
221+ $ this ->traverseNode ($ node );
222+ if ($ this ->stopTraversal ) {
223+ break ;
251224 }
252225 }
253226
0 commit comments