Skip to content

Commit d1b82d9

Browse files
committed
final touch: early verify only [StmtsAwareInterface::class] to avoid regression as possible
1 parent 397ac7d commit d1b82d9

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/Rector/AbstractRector.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ private function decorateCurrentAndChildren(Node $node): void
310310
);
311311

312312
$isCurrentNode = false;
313-
$this->traverseNodesWithCallable($node, static function (Node $subNode) use ($node, $types, $otherTypes, &$isCurrentNode): int|Node {
313+
$this->traverseNodesWithCallable($node, static function (Node $subNode) use ($node, $types, $otherTypes, &$isCurrentNode): null|int|Node {
314314
// first visited is current node itself
315315
if (! $isCurrentNode) {
316316
$isCurrentNode = true;
@@ -324,9 +324,13 @@ private function decorateCurrentAndChildren(Node $node): void
324324
return $subNode;
325325
}
326326

327+
if ($types !== [StmtsAwareInterface::class]) {
328+
return null;
329+
}
330+
327331
// exact StmtsAwareInterface will be visited by itself, and requires revalidated
328332
// no need to apply skip by current rule
329-
if ($types === [StmtsAwareInterface::class] && $node instanceof FunctionLike && $subNode instanceof FunctionLike) {
333+
if ($node instanceof FunctionLike && $subNode instanceof FunctionLike) {
330334
return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN;
331335
}
332336

0 commit comments

Comments
 (0)