diff --git a/rules/EarlyReturn/Rector/Foreach_/ChangeNestedForeachIfsToEarlyContinueRector.php b/rules/EarlyReturn/Rector/Foreach_/ChangeNestedForeachIfsToEarlyContinueRector.php deleted file mode 100644 index 7c512f7b6ad..00000000000 --- a/rules/EarlyReturn/Rector/Foreach_/ChangeNestedForeachIfsToEarlyContinueRector.php +++ /dev/null @@ -1,84 +0,0 @@ -> - */ - public function getNodeTypes(): array - { - return [Foreach_::class]; - } - - /** - * @param Foreach_ $node - */ - public function refactor(Node $node): ?Node - { - throw new ShouldNotHappenException(sprintf( - '"%s" rule is deprecated, as inverting nested ifs to continue makes the code harder to read and understand', - self::class - )); - } -} diff --git a/rules/EarlyReturn/Rector/If_/ChangeNestedIfsToEarlyReturnRector.php b/rules/EarlyReturn/Rector/If_/ChangeNestedIfsToEarlyReturnRector.php deleted file mode 100644 index 197ed25527f..00000000000 --- a/rules/EarlyReturn/Rector/If_/ChangeNestedIfsToEarlyReturnRector.php +++ /dev/null @@ -1,76 +0,0 @@ -> - */ - public function getNodeTypes(): array - { - return NodeGroup::STMTS_AWARE; - } - - public function refactor(Node $node): ?Node - { - throw new ShouldNotHappenException(sprintf( - '"%s" rule is deprecated, as inverting nested ifs to early return makes the code harder to read and understand', - self::class - )); - } -} diff --git a/rules/EarlyReturn/Rector/If_/ChangeOrIfContinueToMultiContinueRector.php b/rules/EarlyReturn/Rector/If_/ChangeOrIfContinueToMultiContinueRector.php deleted file mode 100644 index 307bb18c858..00000000000 --- a/rules/EarlyReturn/Rector/If_/ChangeOrIfContinueToMultiContinueRector.php +++ /dev/null @@ -1,83 +0,0 @@ -hasWheels() || $car->hasFuel()) { - continue; - } - - $car->setWheel($newCar->wheel); - $car->setFuel($newCar->fuel); - } - } -} -CODE_SAMPLE - - , - <<<'CODE_SAMPLE' -class SomeClass -{ - public function canDrive(Car $newCar) - { - foreach ($cars as $car) { - if ($car->hasWheels()) { - continue; - } - if ($car->hasFuel()) { - continue; - } - - $car->setWheel($newCar->wheel); - $car->setFuel($newCar->fuel); - } - } -} -CODE_SAMPLE - ), - ]); - } - - /** - * @return array> - */ - public function getNodeTypes(): array - { - return [If_::class]; - } - - /** - * @param If_ $node - */ - public function refactor(Node $node): ?Node - { - throw new ShouldNotHappenException(sprintf( - '"%s" rule is deprecated, as splitting a single condition into multiple ifs makes the code longer and harder to read', - self::class - )); - } -} diff --git a/rules/EarlyReturn/Rector/Return_/ReturnBinaryOrToEarlyReturnRector.php b/rules/EarlyReturn/Rector/Return_/ReturnBinaryOrToEarlyReturnRector.php deleted file mode 100644 index abd590ae62b..00000000000 --- a/rules/EarlyReturn/Rector/Return_/ReturnBinaryOrToEarlyReturnRector.php +++ /dev/null @@ -1,66 +0,0 @@ -something() || $this->somethingElse(); - } -} -CODE_SAMPLE - - , - <<<'CODE_SAMPLE' -class SomeClass -{ - public function accept() - { - if ($this->something()) { - return true; - } - return (bool) $this->somethingElse(); - } -} -CODE_SAMPLE - ), - ]); - } - - /** - * @return array> - */ - public function getNodeTypes(): array - { - return NodeGroup::STMTS_AWARE; - } - - public function refactor(Node $node): ?Node - { - throw new ShouldNotHappenException(sprintf( - '"%s" rule is deprecated, as splitting a single return into multiple early returns makes the code longer and harder to read', - self::class - )); - } -}