diff --git a/rules/DowngradePhp80/Rector/Expression/DowngradeThrowExprRector.php b/rules/DowngradePhp80/Rector/Expression/DowngradeThrowExprRector.php index 52ab529a16b..16fe4087eb1 100644 --- a/rules/DowngradePhp80/Rector/Expression/DowngradeThrowExprRector.php +++ b/rules/DowngradePhp80/Rector/Expression/DowngradeThrowExprRector.php @@ -190,23 +190,14 @@ private function refactorReturn(Return_ $return): ?array return null; } - $ifCondNotIsset = new BooleanNot(new Isset_([$coalesce->left])); - $if = $this->ifManipulator->createIfExpr($ifCondNotIsset, new Expression($coalesce->right)); + $booleanNot = new BooleanNot(new Isset_([$coalesce->left])); + $if = $this->ifManipulator->createIfExpr($booleanNot, new Expression($coalesce->right)); return [$if, new Return_($coalesce->left)]; } return null; } - private function createIf(Coalesce $coalesce, Throw_ $throw): If_ - { - $condExpr = $this->createCondExpr($coalesce); - - return new If_($condExpr, [ - 'stmts' => [new Expression($throw)], - ]); - } - private function createCondExpr(Coalesce $coalesce): BooleanNot|Identical { if ($coalesce->left instanceof Variable || $coalesce->left instanceof ArrayDimFetch) {