{"record":{"id":"e95383b874404656","repo":"rectorphp/rector","slug":"s-is-deprecated-as-depends-on-context-and-perso","errorCode":null,"errorMessage":"\"%s\" is deprecated as depends on context and personal preference, hard to generalize. Handle it manually or via a custom rule instead","messagePattern":"\"(.+?)\" is deprecated as depends on context and personal preference, hard to generalize\\. Handle it manually or via a custom rule instead","errorType":"exception","errorClass":"ShouldNotHappenException","httpStatus":null,"severity":"error","filePath":"rules/CodeQuality/Rector/Concat/JoinStringConcatRector.php","lineNumber":52,"sourceCode":"        $name = 'Hi Tom';\n    }\n}\nCODE_SAMPLE\n)]);\n    }\n    /**\n     * @return array<class-string<Node>>\n     */\n    public function getNodeTypes(): array\n    {\n        return [Concat::class];\n    }\n    /**\n     * @param Concat $node\n     */\n    public function refactor(Node $node): ?Node\n    {\n        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));\n    }\n}\n","sourceCodeStart":34,"sourceCodeEnd":55,"githubUrl":"https://github.com/rectorphp/rector/blob/408fcb0ff1833e3d26cbc9b04c23a77565814a16/rules/CodeQuality/Rector/Concat/JoinStringConcatRector.php#L34-L55","documentation":"JoinStringConcatRector used to merge chained string concatenations like 'a' . 'b' . $c into fewer parts. It is deprecated because whether joined strings read better is a matter of context and personal taste that cannot be generalized, so refactor() now throws ShouldNotHappenException for every Concat node. The rule performs no work anymore; the exception exists purely to make stale configs fail fast.","triggerScenarios":"Having rules/CodeQuality/Rector/Concat/JoinStringConcatRector.php registered (directly or via a set) and running rector over any file containing a string concatenation expression (. operator). The first Concat node visited triggers the throw at rules/CodeQuality/Rector/Concat/JoinStringConcatRector.php:52.","commonSituations":"An old rector.php with a hand-picked CodeQuality rule list, or a shared company-wide set package, still contains JoinStringConcatRector after upgrading Rector. The crash appears the moment dry-run touches any file with 'literal' . 'literal' concatenation, which is extremely common, so it fails almost immediately.","solutions":["Remove JoinStringConcatRector::class from rector.php and any imported set files, then re-run vendor/bin/rector dry-run","If you want constant-string folding, handle the few occurrences manually or with a targeted script","If join style matters to your team, encode it in a coding-standard tool (PHP-CS-Fixer) rather than Rector","grep -r JoinStringConcatRector across the project to find every registration point"],"exampleFix":"// before (rector.php)\n->withRules([\n    \\Rector\\CodeQuality\\Rector\\Concat\\JoinStringConcatRector::class,\n])\n\n// after\n->withRules([\n    // keep only non-deprecated CodeQuality rules here\n])\n// manually: echo 'Hello' . ' ' . 'world';  ->  echo 'Hello world';","handlingStrategy":"validation","validationCode":"$deprecated = ['JoinStringConcatRector'];\nforeach (glob(__DIR__ . '/rector*.php') as $config) {\n    $src = file_get_contents($config);\n    foreach ($deprecated as $rule) {\n        if (str_contains($src, $rule)) {\n            fwrite(STDERR, \"Remove deprecated rule {$rule} from {$config}\\n\");\n            exit(1);\n        }\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat string-joining style as a coding-standard concern, not a Rector concern","Audit imported set packages for deprecated rule names after each upgrade","Use dry-run on one directory first to catch deprecation guards early","Remove rules you do not actively need instead of carrying a maximal whitelist"],"tags":["rector","php","deprecated-rule","string-concat","code-style"],"backgroundTag":"rector-deprecated-rule","analyzedSha":"408fcb0ff1833e3d26cbc9b04c23a77565814a16","analyzedAt":"2026-08-21T05:11:02.643Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}