diff --git a/rules/CodeQuality/Rector/Coalesce/CoalesceToTernaryRector.php b/rules/CodeQuality/Rector/Coalesce/CoalesceToTernaryRector.php deleted file mode 100644 index a56f26bd8e9..00000000000 --- a/rules/CodeQuality/Rector/Coalesce/CoalesceToTernaryRector.php +++ /dev/null @@ -1,64 +0,0 @@ -> - */ - public function getNodeTypes(): array - { - return [Coalesce::class]; - } - - /** - * @param Coalesce $node - */ - public function refactor(Node $node): ?Node - { - throw new ShouldNotHappenException(sprintf( - '"%s" rule is deprecated, as risky. The "??" and "?:" operators are not interchangeable and a regression has to be fixed manually', - self::class - )); - } -} diff --git a/rules/CodeQuality/Rector/Concat/JoinStringConcatRector.php b/rules/CodeQuality/Rector/Concat/JoinStringConcatRector.php deleted file mode 100644 index 14eb8451f29..00000000000 --- a/rules/CodeQuality/Rector/Concat/JoinStringConcatRector.php +++ /dev/null @@ -1,68 +0,0 @@ -> - */ - public function getNodeTypes(): array - { - return [Concat::class]; - } - - /** - * @param Concat $node - */ - public function refactor(Node $node): ?Node - { - throw new ShouldNotHappenException(sprintf( - '"%s" is deprecated as depends on context and personal preference, hard to generalize. Handle it manually or via a custom rule instead', - self::class - )); - } -} diff --git a/rules/CodeQuality/Rector/Foreach_/UnusedForeachValueToArrayKeysRector.php b/rules/CodeQuality/Rector/Foreach_/UnusedForeachValueToArrayKeysRector.php deleted file mode 100644 index 53c1c1d6fab..00000000000 --- a/rules/CodeQuality/Rector/Foreach_/UnusedForeachValueToArrayKeysRector.php +++ /dev/null @@ -1,74 +0,0 @@ - $value) { - $items[$key] = null; - } - } -} -CODE_SAMPLE - , - <<<'CODE_SAMPLE' -class SomeClass -{ - public function run() - { - $items = []; - foreach (array_keys($values) as $key) { - $items[$key] = null; - } - } -} -CODE_SAMPLE - ), - ] - ); - } - - /** - * @return array> - */ - public function getNodeTypes(): array - { - return NodeGroup::STMTS_AWARE; - } - - /** - * @param StmtsAware $node - */ - public function refactor(Node $node): ?Node - { - throw new ShouldNotHappenException(sprintf( - '"%s" rule is deprecated, as it is a personal preference that makes foreach harder to read and extend', - self::class - )); - } -} diff --git a/rules/CodeQuality/Rector/FuncCall/SimplifyRegexPatternRector.php b/rules/CodeQuality/Rector/FuncCall/SimplifyRegexPatternRector.php deleted file mode 100644 index 069d8738778..00000000000 --- a/rules/CodeQuality/Rector/FuncCall/SimplifyRegexPatternRector.php +++ /dev/null @@ -1,65 +0,0 @@ -> - */ - public function getNodeTypes(): array - { - return [String_::class]; - } - - /** - * @param String_ $node - */ - public function refactor(Node $node): ?String_ - { - throw new ShouldNotHappenException(sprintf( - '"%s" is deprecated, as simplifying regex ranges is a personal preference that can worsen readability', - self::class - )); - } -} diff --git a/rules/CodeQuality/Rector/If_/CombineIfRector.php b/rules/CodeQuality/Rector/If_/CombineIfRector.php deleted file mode 100644 index fb71a15becb..00000000000 --- a/rules/CodeQuality/Rector/If_/CombineIfRector.php +++ /dev/null @@ -1,71 +0,0 @@ -> - */ - 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 merging nested ifs can create much less readable code and depends on context', - self::class - )); - } -} diff --git a/rules/CodeQuality/Rector/If_/ExplicitBoolCompareRector.php b/rules/CodeQuality/Rector/If_/ExplicitBoolCompareRector.php deleted file mode 100644 index 29ca3df16f9..00000000000 --- a/rules/CodeQuality/Rector/If_/ExplicitBoolCompareRector.php +++ /dev/null @@ -1,71 +0,0 @@ -> - */ - public function getNodeTypes(): array - { - return [If_::class, ElseIf_::class, Ternary::class]; - } - - /** - * @param If_|ElseIf_|Ternary $node - */ - public function refactor(Node $node): ?Node - { - throw new ShouldNotHappenException(sprintf( - '"%s" rule is deprecated, as array and object bool compares have dedicated rules and the rest is an opinionated approach that depends on context', - self::class - )); - } -} diff --git a/rules/CodeQuality/Rector/If_/ShortenElseIfRector.php b/rules/CodeQuality/Rector/If_/ShortenElseIfRector.php deleted file mode 100644 index 3ddd7d7159e..00000000000 --- a/rules/CodeQuality/Rector/If_/ShortenElseIfRector.php +++ /dev/null @@ -1,75 +0,0 @@ -> - */ - 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 it creates less readable code and breaks the logical reading of the if train', - self::class - )); - } -} diff --git a/rules/CodeQuality/Rector/If_/SimplifyIfElseToTernaryRector.php b/rules/CodeQuality/Rector/If_/SimplifyIfElseToTernaryRector.php deleted file mode 100644 index 9ba612819de..00000000000 --- a/rules/CodeQuality/Rector/If_/SimplifyIfElseToTernaryRector.php +++ /dev/null @@ -1,72 +0,0 @@ -arrayBuilt[][$key] = true; - } else { - $this->arrayBuilt[][$key] = $value; - } - } -} -CODE_SAMPLE - , - <<<'CODE_SAMPLE' -class SomeClass -{ - public function run() - { - $this->arrayBuilt[][$key] = empty($value) ? true : $value; - } -} -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 the result depends on context and can worsen readability; extract a method instead if needed', - self::class - )); - } -} diff --git a/rules/CodeQuality/Rector/Switch_/SwitchTrueToIfRector.php b/rules/CodeQuality/Rector/Switch_/SwitchTrueToIfRector.php deleted file mode 100644 index ed86bbc9916..00000000000 --- a/rules/CodeQuality/Rector/Switch_/SwitchTrueToIfRector.php +++ /dev/null @@ -1,83 +0,0 @@ -> - */ - public function getNodeTypes(): array - { - return [Switch_::class]; - } - - /** - * @param Switch_ $node - */ - public function refactor(Node $node): ?Node - { - throw new ShouldNotHappenException(sprintf( - '"%s" is deprecated as it worsens readability. Use "match (true)" for the same logic instead', - self::class - )); - } -} diff --git a/rules/CodeQuality/Rector/Ternary/SwitchNegatedTernaryRector.php b/rules/CodeQuality/Rector/Ternary/SwitchNegatedTernaryRector.php deleted file mode 100644 index 8ad6f3adf97..00000000000 --- a/rules/CodeQuality/Rector/Ternary/SwitchNegatedTernaryRector.php +++ /dev/null @@ -1,72 +0,0 @@ -> - */ - public function getNodeTypes(): array - { - return [Ternary::class]; - } - - /** - * @param Ternary $node - */ - public function refactor(Node $node): ?Node - { - throw new ShouldNotHappenException(sprintf( - '"%s" rule is deprecated, as it is a personal preference that can move ternary values out of their logical order', - self::class - )); - } -}