diff --git a/rules/Php85/Rector/Const_/ConstAndTraitDeprecatedAttributeRector.php b/rules/Php85/Rector/Const_/ConstAndTraitDeprecatedAttributeRector.php deleted file mode 100644 index 52c47dabee1..00000000000 --- a/rules/Php85/Rector/Const_/ConstAndTraitDeprecatedAttributeRector.php +++ /dev/null @@ -1,62 +0,0 @@ - pipes depends on the context of surrounding code. It can create extremely long chains that break readability, and where to draw the line is a personal preference. - */ -final class NestedFuncCallsToPipeOperatorRector extends AbstractRector implements MinPhpVersionInterface, ConfigurableRectorInterface, DeprecatedInterface -{ - public const string MINIMUM_DEPTH = 'minimum_depth'; - - /** - * @param array $configuration - */ - public function configure(array $configuration): void - { - } - - public function getRuleDefinition(): RuleDefinition - { - return new RuleDefinition( - 'Convert multiple nested function calls in single line to |> pipe operator', - [ - new ConfiguredCodeSample( - <<<'CODE_SAMPLE' -class SomeClass -{ - public function run($input) - { - $result = trim(strtolower(htmlspecialchars($input))); - } -} -CODE_SAMPLE - , - <<<'CODE_SAMPLE' -class SomeClass -{ - public function run($input) - { - $result = $input - |> htmlspecialchars(...) - |> strtolower(...) - |> trim(...); - } -} -CODE_SAMPLE - , - [ - self::MINIMUM_DEPTH => 3, - ] - )] - ); - } - - public function getNodeTypes(): array - { - return [Expression::class, Return_::class]; - } - - /** - * @param Expression|Return_ $node - */ - public function refactor(Node $node): ?Node - { - throw new ShouldNotHappenException(sprintf( - '"%s" is deprecated, as the pipe chain length that stays readable depends on the context of surrounding code', - self::class - )); - } - - public function provideMinPhpVersion(): int - { - return PhpVersion::PHP_85; - } -} diff --git a/rules/Php85/Rector/StmtsAwareInterface/SequentialAssignmentsToPipeOperatorRector.php b/rules/Php85/Rector/StmtsAwareInterface/SequentialAssignmentsToPipeOperatorRector.php deleted file mode 100644 index ebbb7bbde5f..00000000000 --- a/rules/Php85/Rector/StmtsAwareInterface/SequentialAssignmentsToPipeOperatorRector.php +++ /dev/null @@ -1,71 +0,0 @@ - pipe removes intermediate variables that carry naming and can be re-used later. It also depends on the context of surrounding code and can create extremely long chains that break readability. - */ -final class SequentialAssignmentsToPipeOperatorRector extends AbstractRector implements MinPhpVersionInterface, DeprecatedInterface -{ - public function getRuleDefinition(): RuleDefinition - { - return new RuleDefinition( - 'Transform sequential assignments to pipe operator syntax', - [ - new CodeSample( - <<<'CODE_SAMPLE' -$value = "hello world"; -$result1 = function1($value); -$result2 = function2($result1); - -$result = function3($result2); -CODE_SAMPLE - , - <<<'CODE_SAMPLE' -$value = "hello world"; - -$result = $value - |> function1(...) - |> function2(...) - |> function3(...); -CODE_SAMPLE - ), - ] - ); - } - - public function getNodeTypes(): array - { - return NodeGroup::STMTS_AWARE; - } - - public function provideMinPhpVersion(): int - { - return PhpVersion::PHP_85; - } - - /** - * @param StmtsAware $node - */ - public function refactor(Node $node): ?Node - { - throw new ShouldNotHappenException(sprintf( - '"%s" is deprecated, as it removes intermediate variables that carry naming and can be re-used later', - self::class - )); - } -}