{"record":{"id":"183b2bf365863297","repo":"rectorphp/rector","slug":"s-rule-is-deprecated-as-it-is-a-coding-standar","errorCode":null,"errorMessage":"\"%s\" rule is deprecated, as it is a coding standard preference with no real value","messagePattern":"\"(.+?)\" rule is deprecated, as it is a coding standard preference with no real value","errorType":"exception","errorClass":"ShouldNotHappenException","httpStatus":null,"severity":"error","filePath":"rules/CodingStyle/Rector/Encapsed/WrapEncapsedVariableInCurlyBracesRector.php","lineNumber":46,"sourceCode":"{\n    echo \"Hello {$world}!\";\n}\nCODE_SAMPLE\n)]);\n    }\n    /**\n     * @return array<class-string<Node>>\n     */\n    public function getNodeTypes(): array\n    {\n        return [InterpolatedString::class];\n    }\n    /**\n     * @param InterpolatedString $node\n     */\n    public function refactor(Node $node): ?Node\n    {\n        throw new ShouldNotHappenException(sprintf('\"%s\" rule is deprecated, as it is a coding standard preference with no real value', self::class));\n    }\n}\n","sourceCodeStart":28,"sourceCodeEnd":49,"githubUrl":"https://github.com/rectorphp/rector/blob/408fcb0ff1833e3d26cbc9b04c23a77565814a16/rules/CodingStyle/Rector/Encapsed/WrapEncapsedVariableInCurlyBracesRector.php#L28-L49","documentation":"WrapEncapsedVariableInCurlyBracesRector used to rewrite \"Value: $var\" into \"Value: {$var}\" inside interpolated strings. It is deprecated because it is a coding-standard preference with no real value — both forms are semantically identical. refactor() now throws ShouldNotHappenException on every InterpolatedString node; the class remains only so deprecated configs fail fast.","triggerScenarios":"Registering rules/CodingStyle/Rector/Encapsed/WrapEncapsedVariableInCurlyBracesRector.php and running rector over any file with a double-quoted interpolated string. The throw comes from rules/CodingStyle/Rector/Encapsed/WrapEncapsedVariableInCurlyBracesRector.php:46.","commonSituations":"Teams that standardised on {$var} style added this rule to rector.php years ago; after upgrading rector/rector-prefixed the rule throws instead of rewriting. Set packages copied between projects propagate the stale registration.","solutions":["Remove WrapEncapsedVariableInCurlyBracesRector::class from rector.php and all imported sets, then re-run dry-run","Enforce {$var} style with a coding-standard fixer (PHP-CS-Fixer) if the team still wants it","Apply braces manually in the few places where they disambiguate, e.g. \"{$prefix}s\"","grep -r WrapEncapsedVariableInCurlyBracesRector to catch every config reference"],"exampleFix":"// before (rector.php)\n->withRules([\n    \\Rector\\CodingStyle\\Rector\\Encapsed\\WrapEncapsedVariableInCurlyBracesRector::class,\n])\n// code:\necho \"Hello $name!\";\n\n// after (rector.php)\n// rule removed\n// code unchanged, or braced manually where needed:\necho \"Hello {$name}s!\";","handlingStrategy":"validation","validationCode":"$deprecated = ['WrapEncapsedVariableInCurlyBracesRector'];\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":["Enforce brace style with a coding-standard fixer, not Rector","Add {$var} manually only where adjacency demands it (\"{$prefix}s\")","Delete deprecated rules from rector.php before upgrading","Keep configs importing curated sets rather than exhaustive rule lists"],"tags":["rector","php","deprecated-rule","string-interpolation","curly-braces","code-style"],"backgroundTag":"rector-deprecated-rule","analyzedSha":"408fcb0ff1833e3d26cbc9b04c23a77565814a16","analyzedAt":"2026-08-21T05:11:02.643Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}