{"record":{"id":"018b9db63796a376","repo":"rectorphp/rector","slug":"s-is-deprecated-as-the-pipe-chain-length-that","errorCode":null,"errorMessage":"\"%s\" is deprecated, as the pipe chain length that stays readable depends on the context of surrounding code","messagePattern":"\"(.+?)\" is deprecated, as the pipe chain length that stays readable depends on the context of surrounding code","errorType":"exception","errorClass":"ShouldNotHappenException","httpStatus":null,"severity":"error","filePath":"rules/Php85/Rector/Expression/NestedFuncCallsToPipeOperatorRector.php","lineNumber":67,"sourceCode":"        $result = $input\n            |> htmlspecialchars(...)\n            |> strtolower(...)\n            |> trim(...);\n    }\n}\nCODE_SAMPLE\n, [self::MINIMUM_DEPTH => 3])]);\n    }\n    public function getNodeTypes(): array\n    {\n        return [Expression::class, Return_::class];\n    }\n    /**\n     * @param Expression|Return_ $node\n     */\n    public function refactor(Node $node): ?Node\n    {\n        throw new ShouldNotHappenException(sprintf('\"%s\" is deprecated, as the pipe chain length that stays readable depends on the context of surrounding code', self::class));\n    }\n    public function provideMinPhpVersion(): int\n    {\n        return PhpVersionFeature::PIPE_OPERATOER;\n    }\n}\n","sourceCodeStart":49,"sourceCodeEnd":74,"githubUrl":"https://github.com/rectorphp/rector/blob/408fcb0ff1833e3d26cbc9b04c23a77565814a16/rules/Php85/Rector/Expression/NestedFuncCallsToPipeOperatorRector.php#L49-L74","documentation":"Rector\\Php85\\Rector\\Expression\\NestedFuncCallsToPipeOperatorRector is deprecated: refactor() throws Rector\\Exception\\ShouldNotHappenException on the first Expression or Return_ node. The rule rewrote nested calls like strtolower(trim($s)) into PHP 8.5 pipe chains, but how long a chain stays readable depends entirely on the surrounding code, so the old MINIMUM_DEPTH threshold (default 3, shown in the rule's own configured code sample) cannot be a safe default. The rule only loads on PhpVersionFeature::PIPE_OPERATOER (PHP 8.5) targets.","triggerScenarios":"The rule is still listed in a PHP 8.5 rule list and rector visits any expression statement or return statement; refactor() throws on the first match, even if the old MINIMUM_DEPTH configuration was passed (it is ignored).","commonSituations":"Enabling all Php85 rules after a rector upgrade; configs copied from pipe-operator announcement posts; CI failing on the very first analyzed statement.","solutions":["Remove NestedFuncCallsToPipeOperatorRector from rector.php.","Rewrite specific hot spots into pipe chains by hand where the chain actually improves readability.","If your team has a hard style rule, encode it in a custom rule scoped to your codebase instead of re-enabling this one."],"exampleFix":"// before (rector.php)\n->withConfiguredRule(NestedFuncCallsToPipeOperatorRector::class, [\n    NestedFuncCallsToPipeOperatorRector::MINIMUM_DEPTH => 3,\n])\n\n// after (rector.php) - removed; convert by hand where it reads better\n\n// manual (PHP 8.5):\n$name = $input |> trim(...) |> strtolower(...);","handlingStrategy":"validation","validationCode":"use Rector\\Php85\\Rector\\Expression\\NestedFuncCallsToPipeOperatorRector;\n\n$rules = [/* your list */ NestedFuncCallsToPipeOperatorRector::class];\nif (in_array(NestedFuncCallsToPipeOperatorRector::class, $rules, true)) {\n    throw new InvalidArgumentException('Rule deprecated; write pipe chains manually where readability improves');\n}","typeGuard":null,"tryCatchPattern":"try {\n    exit($rectorApplication->run());\n} catch (\\Rector\\Exception\\ShouldNotHappenException $e) {\n    if (str_contains($e->getMessage(), 'NestedFuncCallsToPipeOperator')) {\n        fwrite(STDERR, 'Remove the rule; chain length is a per-case readability judgement, not a fixed threshold.' . PHP_EOL);\n        exit(1);\n    }\n    throw $e;\n}","preventionTips":["Do not rely on the old MINIMUM_DEPTH setting - the rule ignores configuration and throws regardless.","Adopt new syntax like the pipe operator through reviewed manual edits, not bulk rewrites.","Track rector release notes for PHP 8.5 rules before enabling a copied 'modernize' config."],"tags":["rector","php","pipe-operator","php85","deprecated-rule"],"backgroundTag":"deprecated-api-invoked","analyzedSha":"408fcb0ff1833e3d26cbc9b04c23a77565814a16","analyzedAt":"2026-08-21T05:11:02.643Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}