From e1ec88dcfc8f52228575fd79e9b72194289fa215 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Tue, 24 Nov 2026 08:47:50 +0100 Subject: [PATCH 1/3] [CodeQuality] Add RemovePreviousExceptionCodeRector --- .../Fixture/named_argument.php.inc | 35 ----- ..._argument_for_message_and_previous.php.inc | 39 ----- .../Fixture/skip_named_argument.php.inc | 15 ++ ..._argument_for_message_and_previous.php.inc | 17 ++ .../Fixture/named.php.inc | 53 +++++++ .../Fixture/positional.php.inc | 35 +++++ .../skip_custom_parameter_order.php.inc | 23 +++ .../Fixture/skip_different_code.php.inc | 33 ++++ .../RemovePreviousExceptionCodeRectorTest.php | 28 ++++ .../config/configured_rule.php | 9 ++ .../ThrowWithPreviousExceptionRector.php | 10 +- .../RemovePreviousExceptionCodeRector.php | 147 ++++++++++++++++++ src/Config/Level/CodeQualityLevel.php | 2 + 13 files changed, 364 insertions(+), 82 deletions(-) delete mode 100644 rules-tests/CodeQuality/Rector/Catch_/ThrowWithPreviousExceptionRector/Fixture/named_argument.php.inc delete mode 100644 rules-tests/CodeQuality/Rector/Catch_/ThrowWithPreviousExceptionRector/Fixture/named_argument_for_message_and_previous.php.inc create mode 100644 rules-tests/CodeQuality/Rector/Catch_/ThrowWithPreviousExceptionRector/Fixture/skip_named_argument.php.inc create mode 100644 rules-tests/CodeQuality/Rector/Catch_/ThrowWithPreviousExceptionRector/Fixture/skip_named_argument_for_message_and_previous.php.inc create mode 100644 rules-tests/CodeQuality/Rector/New_/RemovePreviousExceptionCodeRector/Fixture/named.php.inc create mode 100644 rules-tests/CodeQuality/Rector/New_/RemovePreviousExceptionCodeRector/Fixture/positional.php.inc create mode 100644 rules-tests/CodeQuality/Rector/New_/RemovePreviousExceptionCodeRector/Fixture/skip_custom_parameter_order.php.inc create mode 100644 rules-tests/CodeQuality/Rector/New_/RemovePreviousExceptionCodeRector/Fixture/skip_different_code.php.inc create mode 100644 rules-tests/CodeQuality/Rector/New_/RemovePreviousExceptionCodeRector/RemovePreviousExceptionCodeRectorTest.php create mode 100644 rules-tests/CodeQuality/Rector/New_/RemovePreviousExceptionCodeRector/config/configured_rule.php create mode 100644 rules/CodeQuality/Rector/New_/RemovePreviousExceptionCodeRector.php diff --git a/rules-tests/CodeQuality/Rector/Catch_/ThrowWithPreviousExceptionRector/Fixture/named_argument.php.inc b/rules-tests/CodeQuality/Rector/Catch_/ThrowWithPreviousExceptionRector/Fixture/named_argument.php.inc deleted file mode 100644 index 792b460802d..00000000000 --- a/rules-tests/CodeQuality/Rector/Catch_/ThrowWithPreviousExceptionRector/Fixture/named_argument.php.inc +++ /dev/null @@ -1,35 +0,0 @@ -run(); - }catch(\Throwable $throwable) { - throw new \LogicException('Some exception', previous: $throwable); - } - } -} - -?> ------ -run(); - }catch(\Throwable $throwable) { - throw new \LogicException('Some exception', $throwable->getCode(), previous: $throwable); - } - } -} - -?> diff --git a/rules-tests/CodeQuality/Rector/Catch_/ThrowWithPreviousExceptionRector/Fixture/named_argument_for_message_and_previous.php.inc b/rules-tests/CodeQuality/Rector/Catch_/ThrowWithPreviousExceptionRector/Fixture/named_argument_for_message_and_previous.php.inc deleted file mode 100644 index 288f9996267..00000000000 --- a/rules-tests/CodeQuality/Rector/Catch_/ThrowWithPreviousExceptionRector/Fixture/named_argument_for_message_and_previous.php.inc +++ /dev/null @@ -1,39 +0,0 @@ -run(); - }catch(\Throwable $throwable) { - throw new LogicException(message: 'Some exception', previous: $throwable); - } - } -} - -?> ------ -run(); - }catch(\Throwable $throwable) { - throw new LogicException(message: 'Some exception', code: $throwable->getCode(), previous: $throwable); - } - } -} - -?> diff --git a/rules-tests/CodeQuality/Rector/Catch_/ThrowWithPreviousExceptionRector/Fixture/skip_named_argument.php.inc b/rules-tests/CodeQuality/Rector/Catch_/ThrowWithPreviousExceptionRector/Fixture/skip_named_argument.php.inc new file mode 100644 index 00000000000..1e3f425dde8 --- /dev/null +++ b/rules-tests/CodeQuality/Rector/Catch_/ThrowWithPreviousExceptionRector/Fixture/skip_named_argument.php.inc @@ -0,0 +1,15 @@ +run(); + }catch(\Throwable $throwable) { + throw new \LogicException('Some exception', previous: $throwable); + } + } +} diff --git a/rules-tests/CodeQuality/Rector/Catch_/ThrowWithPreviousExceptionRector/Fixture/skip_named_argument_for_message_and_previous.php.inc b/rules-tests/CodeQuality/Rector/Catch_/ThrowWithPreviousExceptionRector/Fixture/skip_named_argument_for_message_and_previous.php.inc new file mode 100644 index 00000000000..deb1e100b69 --- /dev/null +++ b/rules-tests/CodeQuality/Rector/Catch_/ThrowWithPreviousExceptionRector/Fixture/skip_named_argument_for_message_and_previous.php.inc @@ -0,0 +1,17 @@ +run(); + }catch(\Throwable $throwable) { + throw new LogicException(message: 'Some exception', previous: $throwable); + } + } +} diff --git a/rules-tests/CodeQuality/Rector/New_/RemovePreviousExceptionCodeRector/Fixture/named.php.inc b/rules-tests/CodeQuality/Rector/New_/RemovePreviousExceptionCodeRector/Fixture/named.php.inc new file mode 100644 index 00000000000..ed5eca7d21e --- /dev/null +++ b/rules-tests/CodeQuality/Rector/New_/RemovePreviousExceptionCodeRector/Fixture/named.php.inc @@ -0,0 +1,53 @@ +run(); + } catch (\Throwable $throwable) { + throw new \RuntimeException(message: 'Failed', code: $throwable->getCode(), previous: $throwable); + } + } + + public function mixed() + { + try { + $this->run(); + } catch (\Throwable $throwable) { + throw new \RuntimeException('Failed', $throwable->getCode(), previous: $throwable); + } + } +} + +?> +----- +run(); + } catch (\Throwable $throwable) { + throw new \RuntimeException(message: 'Failed', previous: $throwable); + } + } + + public function mixed() + { + try { + $this->run(); + } catch (\Throwable $throwable) { + throw new \RuntimeException('Failed', previous: $throwable); + } + } +} + +?> diff --git a/rules-tests/CodeQuality/Rector/New_/RemovePreviousExceptionCodeRector/Fixture/positional.php.inc b/rules-tests/CodeQuality/Rector/New_/RemovePreviousExceptionCodeRector/Fixture/positional.php.inc new file mode 100644 index 00000000000..46982912b1b --- /dev/null +++ b/rules-tests/CodeQuality/Rector/New_/RemovePreviousExceptionCodeRector/Fixture/positional.php.inc @@ -0,0 +1,35 @@ +run(); + } catch (\Throwable $throwable) { + throw new \RuntimeException('Failed', $throwable->getCode(), $throwable); + } + } +} + +?> +----- +run(); + } catch (\Throwable $throwable) { + throw new \RuntimeException('Failed', previous: $throwable); + } + } +} + +?> diff --git a/rules-tests/CodeQuality/Rector/New_/RemovePreviousExceptionCodeRector/Fixture/skip_custom_parameter_order.php.inc b/rules-tests/CodeQuality/Rector/New_/RemovePreviousExceptionCodeRector/Fixture/skip_custom_parameter_order.php.inc new file mode 100644 index 00000000000..1496d01bbc6 --- /dev/null +++ b/rules-tests/CodeQuality/Rector/New_/RemovePreviousExceptionCodeRector/Fixture/skip_custom_parameter_order.php.inc @@ -0,0 +1,23 @@ +run(); + } catch (\Throwable $throwable) { + throw new CustomOrderException('Failed', $throwable->getCode(), $throwable); + } + } +} diff --git a/rules-tests/CodeQuality/Rector/New_/RemovePreviousExceptionCodeRector/Fixture/skip_different_code.php.inc b/rules-tests/CodeQuality/Rector/New_/RemovePreviousExceptionCodeRector/Fixture/skip_different_code.php.inc new file mode 100644 index 00000000000..592ee462a07 --- /dev/null +++ b/rules-tests/CodeQuality/Rector/New_/RemovePreviousExceptionCodeRector/Fixture/skip_different_code.php.inc @@ -0,0 +1,33 @@ +run($other); + } catch (\Throwable $throwable) { + throw new \RuntimeException('Failed', 404, $throwable); + } + } + + public function otherVariable(\Throwable $other) + { + try { + $this->run($other); + } catch (\Throwable $throwable) { + throw new \RuntimeException('Failed', $other->getCode(), $throwable); + } + } + + public function missingPrevious(\Throwable $other) + { + try { + $this->run($other); + } catch (\Throwable $throwable) { + throw new \RuntimeException('Failed', $throwable->getCode()); + } + } +} diff --git a/rules-tests/CodeQuality/Rector/New_/RemovePreviousExceptionCodeRector/RemovePreviousExceptionCodeRectorTest.php b/rules-tests/CodeQuality/Rector/New_/RemovePreviousExceptionCodeRector/RemovePreviousExceptionCodeRectorTest.php new file mode 100644 index 00000000000..60470f518b6 --- /dev/null +++ b/rules-tests/CodeQuality/Rector/New_/RemovePreviousExceptionCodeRector/RemovePreviousExceptionCodeRectorTest.php @@ -0,0 +1,28 @@ +doTestFile($filePath); + } + + public static function provideData(): Iterator + { + return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); + } + + public function provideConfigFilePath(): string + { + return __DIR__ . '/config/configured_rule.php'; + } +} diff --git a/rules-tests/CodeQuality/Rector/New_/RemovePreviousExceptionCodeRector/config/configured_rule.php b/rules-tests/CodeQuality/Rector/New_/RemovePreviousExceptionCodeRector/config/configured_rule.php new file mode 100644 index 00000000000..a6ca53aa1bc --- /dev/null +++ b/rules-tests/CodeQuality/Rector/New_/RemovePreviousExceptionCodeRector/config/configured_rule.php @@ -0,0 +1,9 @@ +withRules([RemovePreviousExceptionCodeRector::class]); diff --git a/rules/CodeQuality/Rector/Catch_/ThrowWithPreviousExceptionRector.php b/rules/CodeQuality/Rector/Catch_/ThrowWithPreviousExceptionRector.php index 73b177e3038..90647407aad 100644 --- a/rules/CodeQuality/Rector/Catch_/ThrowWithPreviousExceptionRector.php +++ b/rules/CodeQuality/Rector/Catch_/ThrowWithPreviousExceptionRector.php @@ -185,14 +185,8 @@ private function refactorThrow(Throw_ $throw, Variable $caughtThrowableVariable) /** @var Arg $arg1 */ $arg1 = $new->args[1]; if ($arg1->name instanceof Identifier && $arg1->name->toString() === 'previous') { - if ($hasCodeParameter && ! $hasCodeArgument) { - $new->args[1] = new Arg( - new MethodCall($caughtThrowableVariable, 'getCode'), - name: $shouldUseNamedArguments ? new Identifier('code') : null - ); - $new->args[$exceptionArgumentPosition] = $arg1; - $hasChanged = true; - } elseif (! $hasChanged) { + // previous is already passed, code is omitted on purpose + if (! $hasChanged) { return null; } } elseif ($this->hasParameter($new, 'previous') && ! $this->hasArgument($new, 'previous')) { diff --git a/rules/CodeQuality/Rector/New_/RemovePreviousExceptionCodeRector.php b/rules/CodeQuality/Rector/New_/RemovePreviousExceptionCodeRector.php new file mode 100644 index 00000000000..25328f3f804 --- /dev/null +++ b/rules/CodeQuality/Rector/New_/RemovePreviousExceptionCodeRector.php @@ -0,0 +1,147 @@ +getCode(), $throwable); +} +CODE_SAMPLE + , + <<<'CODE_SAMPLE' +try { + $someCode = 1; +} catch (Throwable $throwable) { + throw new \RuntimeException('ups', previous: $throwable); +} +CODE_SAMPLE + ), + ] + ); + } + + /** + * @return array> + */ + public function getNodeTypes(): array + { + return [New_::class]; + } + + /** + * @param New_ $node + */ + public function refactor(Node $node): ?Node + { + if ($node->isFirstClassCallable()) { + return null; + } + + if (! $node->class instanceof Name) { + return null; + } + + $args = $node->getArgs(); + if (count($args) !== 3) { + return null; + } + + $codeArg = $node->getArg('code', self::CODE_POSITION); + $previousArg = $node->getArg('previous', self::PREVIOUS_POSITION); + if (! $codeArg instanceof Arg || ! $previousArg instanceof Arg) { + return null; + } + + if (! $previousArg->value instanceof Variable) { + return null; + } + + if (! $codeArg->value instanceof MethodCall || ! $this->isName($codeArg->value->name, 'getCode')) { + return null; + } + + if (! $this->nodeComparator->areNodesEqual($codeArg->value->var, $previousArg->value)) { + return null; + } + + if (! $this->isObjectType($node->class, new ObjectType('Throwable'))) { + return null; + } + + if (! $this->hasCodeAndPreviousParameterPositions($node->class)) { + return null; + } + + $node->args = array_values(array_filter($node->args, fn ($arg): bool => $arg !== $codeArg)); + $previousArg->name = new Identifier('previous'); + + return $node; + } + + private function hasCodeAndPreviousParameterPositions(Name $name): bool + { + $className = $this->getName($name); + if (! $this->reflectionProvider->hasClass($className)) { + return false; + } + + $classReflection = $this->reflectionProvider->getClass($className); + if (! $classReflection->hasConstructor()) { + return false; + } + + $extendedParametersAcceptor = ParametersAcceptorSelector::combineAcceptors( + $classReflection->getConstructor() + ->getVariants() + ); + $parameters = $extendedParametersAcceptor->getParameters(); + + if (! isset($parameters[self::CODE_POSITION], $parameters[self::PREVIOUS_POSITION])) { + return false; + } + + if ($parameters[self::CODE_POSITION]->getName() !== 'code') { + return false; + } + + return $parameters[self::PREVIOUS_POSITION]->getName() === 'previous'; + } +} diff --git a/src/Config/Level/CodeQualityLevel.php b/src/Config/Level/CodeQualityLevel.php index e6368998a57..2c1fc751c31 100644 --- a/src/Config/Level/CodeQualityLevel.php +++ b/src/Config/Level/CodeQualityLevel.php @@ -53,6 +53,7 @@ use Rector\CodeQuality\Rector\LogicalAnd\AndAssignsToSeparateLinesRector; use Rector\CodeQuality\Rector\LogicalAnd\LogicalToBooleanRector; use Rector\CodeQuality\Rector\New_\NewStaticToNewSelfRector; +use Rector\CodeQuality\Rector\New_\RemovePreviousExceptionCodeRector; use Rector\CodeQuality\Rector\NotEqual\CommonNotEqualRector; use Rector\CodeQuality\Rector\NullsafeMethodCall\CleanupUnneededNullsafeOperatorRector; use Rector\CodeQuality\Rector\Property\FixClassCaseSensitivityVarDocblockRector; @@ -128,6 +129,7 @@ final class CodeQualityLevel ArrayExplicitBoolCompareRector::class, ExplicitNullableObjectInstanceRector::class, ThrowWithPreviousExceptionRector::class, + RemovePreviousExceptionCodeRector::class, RemoveSoleValueSprintfRector::class, ExplicitReturnNullRector::class, ArrayMergeOfNonArraysToSimpleArrayRector::class, From 1b17dfad8a0fed094595d1041a6cfdc7fa3db636 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Tue, 24 Nov 2026 07:48:41 +0000 Subject: [PATCH 2/3] [ci-review] Rector Rectify --- .../Rector/New_/RemovePreviousExceptionCodeRector.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rules/CodeQuality/Rector/New_/RemovePreviousExceptionCodeRector.php b/rules/CodeQuality/Rector/New_/RemovePreviousExceptionCodeRector.php index 25328f3f804..63b78ab7a60 100644 --- a/rules/CodeQuality/Rector/New_/RemovePreviousExceptionCodeRector.php +++ b/rules/CodeQuality/Rector/New_/RemovePreviousExceptionCodeRector.php @@ -4,6 +4,8 @@ namespace Rector\CodeQuality\Rector\New_; +use PhpParser\Node\VariadicPlaceholder; +use PhpParser\Node\ArgPlaceholder; use PhpParser\Node; use PhpParser\Node\Arg; use PhpParser\Node\Expr\MethodCall; @@ -110,7 +112,7 @@ public function refactor(Node $node): ?Node return null; } - $node->args = array_values(array_filter($node->args, fn ($arg): bool => $arg !== $codeArg)); + $node->args = array_values(array_filter($node->args, fn (Arg|VariadicPlaceholder|ArgPlaceholder $arg): bool => $arg !== $codeArg)); $previousArg->name = new Identifier('previous'); return $node; From c7b2906720e5ea85450d41e5df662bdbde1b9a2d Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Tue, 24 Nov 2026 11:05:33 +0100 Subject: [PATCH 3/3] Rename to NarrowPreviousExceptionCodeArgRector, add to named-args set --- config/set/named-args.php | 2 ++ .../Fixture/named.php.inc | 4 ++-- .../Fixture/positional.php.inc | 4 ++-- .../Fixture/skip_custom_parameter_order.php.inc | 2 +- .../Fixture/skip_different_code.php.inc | 2 +- .../NarrowPreviousExceptionCodeArgRectorTest.php} | 4 ++-- .../config/configured_rule.php | 9 +++++++++ .../config/configured_rule.php | 9 --------- ...ctor.php => NarrowPreviousExceptionCodeArgRector.php} | 8 ++++---- src/Config/Level/CodeQualityLevel.php | 4 ++-- 10 files changed, 25 insertions(+), 23 deletions(-) rename rules-tests/CodeQuality/Rector/New_/{RemovePreviousExceptionCodeRector => NarrowPreviousExceptionCodeArgRector}/Fixture/named.php.inc (83%) rename rules-tests/CodeQuality/Rector/New_/{RemovePreviousExceptionCodeRector => NarrowPreviousExceptionCodeArgRector}/Fixture/positional.php.inc (73%) rename rules-tests/CodeQuality/Rector/New_/{RemovePreviousExceptionCodeRector => NarrowPreviousExceptionCodeArgRector}/Fixture/skip_custom_parameter_order.php.inc (83%) rename rules-tests/CodeQuality/Rector/New_/{RemovePreviousExceptionCodeRector => NarrowPreviousExceptionCodeArgRector}/Fixture/skip_different_code.php.inc (88%) rename rules-tests/CodeQuality/Rector/New_/{RemovePreviousExceptionCodeRector/RemovePreviousExceptionCodeRectorTest.php => NarrowPreviousExceptionCodeArgRector/NarrowPreviousExceptionCodeArgRectorTest.php} (76%) create mode 100644 rules-tests/CodeQuality/Rector/New_/NarrowPreviousExceptionCodeArgRector/config/configured_rule.php delete mode 100644 rules-tests/CodeQuality/Rector/New_/RemovePreviousExceptionCodeRector/config/configured_rule.php rename rules/CodeQuality/Rector/New_/{RemovePreviousExceptionCodeRector.php => NarrowPreviousExceptionCodeArgRector.php} (95%) diff --git a/config/set/named-args.php b/config/set/named-args.php index ae54d0d150a..44a1c6313dc 100644 --- a/config/set/named-args.php +++ b/config/set/named-args.php @@ -7,6 +7,7 @@ use Rector\CodeQuality\Rector\CallLike\AddNameToBooleanArgumentRector; use Rector\CodeQuality\Rector\CallLike\AddNameToNullArgumentRector; use Rector\CodeQuality\Rector\FuncCall\SortCallLikeNamedArgsRector; +use Rector\CodeQuality\Rector\New_\NarrowPreviousExceptionCodeArgRector; use Rector\Config\RectorConfig; use Rector\DeadCode\Rector\MethodCall\RemoveNullNamedArgOnNullDefaultParamRector; @@ -18,5 +19,6 @@ SortCallLikeNamedArgsRector::class, SortAttributeNamedArgsRector::class, ExplicitAttributeNamedArgsRector::class, + NarrowPreviousExceptionCodeArgRector::class, ]); }; diff --git a/rules-tests/CodeQuality/Rector/New_/RemovePreviousExceptionCodeRector/Fixture/named.php.inc b/rules-tests/CodeQuality/Rector/New_/NarrowPreviousExceptionCodeArgRector/Fixture/named.php.inc similarity index 83% rename from rules-tests/CodeQuality/Rector/New_/RemovePreviousExceptionCodeRector/Fixture/named.php.inc rename to rules-tests/CodeQuality/Rector/New_/NarrowPreviousExceptionCodeArgRector/Fixture/named.php.inc index ed5eca7d21e..2040d54d4cb 100644 --- a/rules-tests/CodeQuality/Rector/New_/RemovePreviousExceptionCodeRector/Fixture/named.php.inc +++ b/rules-tests/CodeQuality/Rector/New_/NarrowPreviousExceptionCodeArgRector/Fixture/named.php.inc @@ -1,6 +1,6 @@ withRules([NarrowPreviousExceptionCodeArgRector::class]); diff --git a/rules-tests/CodeQuality/Rector/New_/RemovePreviousExceptionCodeRector/config/configured_rule.php b/rules-tests/CodeQuality/Rector/New_/RemovePreviousExceptionCodeRector/config/configured_rule.php deleted file mode 100644 index a6ca53aa1bc..00000000000 --- a/rules-tests/CodeQuality/Rector/New_/RemovePreviousExceptionCodeRector/config/configured_rule.php +++ /dev/null @@ -1,9 +0,0 @@ -withRules([RemovePreviousExceptionCodeRector::class]); diff --git a/rules/CodeQuality/Rector/New_/RemovePreviousExceptionCodeRector.php b/rules/CodeQuality/Rector/New_/NarrowPreviousExceptionCodeArgRector.php similarity index 95% rename from rules/CodeQuality/Rector/New_/RemovePreviousExceptionCodeRector.php rename to rules/CodeQuality/Rector/New_/NarrowPreviousExceptionCodeArgRector.php index 63b78ab7a60..d1d81c3069a 100644 --- a/rules/CodeQuality/Rector/New_/RemovePreviousExceptionCodeRector.php +++ b/rules/CodeQuality/Rector/New_/NarrowPreviousExceptionCodeArgRector.php @@ -4,15 +4,15 @@ namespace Rector\CodeQuality\Rector\New_; -use PhpParser\Node\VariadicPlaceholder; -use PhpParser\Node\ArgPlaceholder; use PhpParser\Node; use PhpParser\Node\Arg; +use PhpParser\Node\ArgPlaceholder; use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Expr\New_; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Identifier; use PhpParser\Node\Name; +use PhpParser\Node\VariadicPlaceholder; use PHPStan\Reflection\ParametersAcceptorSelector; use PHPStan\Reflection\ReflectionProvider; use PHPStan\Type\ObjectType; @@ -21,9 +21,9 @@ use Rector\RuleDoc\RuleDefinition; /** - * @see \Rector\Tests\CodeQuality\Rector\New_\RemovePreviousExceptionCodeRector\RemovePreviousExceptionCodeRectorTest + * @see \Rector\Tests\CodeQuality\Rector\New_\NarrowPreviousExceptionCodeArgRector\NarrowPreviousExceptionCodeArgRectorTest */ -final class RemovePreviousExceptionCodeRector extends AbstractRector +final class NarrowPreviousExceptionCodeArgRector extends AbstractRector { private const int CODE_POSITION = 1; diff --git a/src/Config/Level/CodeQualityLevel.php b/src/Config/Level/CodeQualityLevel.php index 2c1fc751c31..1a0808a4ccc 100644 --- a/src/Config/Level/CodeQualityLevel.php +++ b/src/Config/Level/CodeQualityLevel.php @@ -52,8 +52,8 @@ use Rector\CodeQuality\Rector\Isset_\IssetOnPropertyObjectToPropertyExistsRector; use Rector\CodeQuality\Rector\LogicalAnd\AndAssignsToSeparateLinesRector; use Rector\CodeQuality\Rector\LogicalAnd\LogicalToBooleanRector; +use Rector\CodeQuality\Rector\New_\NarrowPreviousExceptionCodeArgRector; use Rector\CodeQuality\Rector\New_\NewStaticToNewSelfRector; -use Rector\CodeQuality\Rector\New_\RemovePreviousExceptionCodeRector; use Rector\CodeQuality\Rector\NotEqual\CommonNotEqualRector; use Rector\CodeQuality\Rector\NullsafeMethodCall\CleanupUnneededNullsafeOperatorRector; use Rector\CodeQuality\Rector\Property\FixClassCaseSensitivityVarDocblockRector; @@ -129,7 +129,7 @@ final class CodeQualityLevel ArrayExplicitBoolCompareRector::class, ExplicitNullableObjectInstanceRector::class, ThrowWithPreviousExceptionRector::class, - RemovePreviousExceptionCodeRector::class, + NarrowPreviousExceptionCodeArgRector::class, RemoveSoleValueSprintfRector::class, ExplicitReturnNullRector::class, ArrayMergeOfNonArraysToSimpleArrayRector::class,