diff --git a/rules/EarlyReturn/Rector/If_/ChangeOrIfReturnToEarlyReturnRector.php b/rules/EarlyReturn/Rector/If_/ChangeOrIfReturnToEarlyReturnRector.php index a9edd1cf90a..364a9e3fb40 100644 --- a/rules/EarlyReturn/Rector/If_/ChangeOrIfReturnToEarlyReturnRector.php +++ b/rules/EarlyReturn/Rector/If_/ChangeOrIfReturnToEarlyReturnRector.php @@ -91,19 +91,8 @@ public function refactor(Node $node): ?Node return null; } - $nextNode = $node->getAttribute(AttributeKey::NEXT_NODE); - if ($this->shouldSkip($nextNode)) { - return null; - } - /** @var Return_ $return */ $return = $node->stmts[0]; - - // avoid repetitive ifs combined with other rules - if ($nextNode instanceof Return_ && $this->nodeComparator->areNodesEqual($nextNode->expr, $return->expr)) { - return null; - } - $ifs = $this->createMultipleIfs($node->cond, $return, []); foreach ($ifs as $key => $if) { @@ -118,15 +107,6 @@ public function refactor(Node $node): ?Node return $node; } - private function shouldSkip(?Node $nextNode): bool - { - if ($nextNode === null) { - return false; - } - - return $nextNode instanceof Return_ && $nextNode->expr === null; - } - /** * @param If_[] $ifs * @return If_[]