{"record":{"id":"ab0a12d4806d5eaa","repo":"rectorphp/rector","slug":"s-rule-is-deprecated-as-splitting-a-single-con","errorCode":null,"errorMessage":"\"%s\" rule is deprecated, as splitting a single condition into multiple ifs makes the code longer and harder to read","messagePattern":"\"(.+?)\" rule is deprecated, as splitting a single condition into multiple ifs makes the code longer and harder to read","errorType":"exception","errorClass":"ShouldNotHappenException","httpStatus":null,"severity":"error","filePath":"rules/EarlyReturn/Rector/If_/ChangeOrIfContinueToMultiContinueRector.php","lineNumber":69,"sourceCode":"        }\n    }\n}\nCODE_SAMPLE\n)]);\n    }\n    /**\n     * @return array<class-string<Node>>\n     */\n    public function getNodeTypes(): array\n    {\n        return [If_::class];\n    }\n    /**\n     * @param If_ $node\n     */\n    public function refactor(Node $node): ?Node\n    {\n        throw new ShouldNotHappenException(sprintf('\"%s\" rule is deprecated, as splitting a single condition into multiple ifs makes the code longer and harder to read', self::class));\n    }\n}\n","sourceCodeStart":51,"sourceCodeEnd":72,"githubUrl":"https://github.com/rectorphp/rector/blob/408fcb0ff1833e3d26cbc9b04c23a77565814a16/rules/EarlyReturn/Rector/If_/ChangeOrIfContinueToMultiContinueRector.php#L51-L72","documentation":"Thrown when the deprecated ChangeOrIfContinueToMultiContinueRector rule executes. Its refactor() unconditionally throws ShouldNotHappenException because splitting a single `if (A || B) continue;` condition into multiple if-continue statements was judged to make code longer and harder to read. The class remains only so that stale configs referencing it fail loudly instead of silently doing nothing.","triggerScenarios":"`rector process` with a config that still registers `\\Rector\\EarlyReturn\\Rector\\If_\\ChangeOrIfContinueToMultiContinueRector::class`. The rule declares getNodeTypes() = [If_::class], so the throw happens on the first `if` statement Rector visits in the analyzed codebase.","commonSituations":"Upgrading rector/rector across major versions with an unchanged rector.php that listed EarlyReturn rules one by one; reusing a legacy config file from another project; CI pipeline breaking right after a dependency update because the deprecated rule now throws instead of refactoring.","solutions":["Delete the `ChangeOrIfContinueToMultiContinueRector::class` line from your rector config and re-run.","Audit the config for the other deprecated EarlyReturn rules (ChangeNestedIfsToEarlyReturnRector, ReturnBinaryOrToEarlyReturnRector) and remove them together.","If you want that specific transformation, apply it by hand or implement a small custom Rector rule in your project.","As a stopgap, pin the previous Rector version that still shipped the working rule."],"exampleFix":"// before - rector.php\n$rectorConfig->rules([\n    \\Rector\\EarlyReturn\\Rector\\If_\\ChangeOrIfContinueToMultiContinueRector::class,\n]);\n\n// after - registration removed; keep `if ($a || $b) { continue; }` as-is\n// or split it manually where it genuinely reads better","handlingStrategy":"validation","validationCode":"$config = file_get_contents('rector.php');\nif (strpos($config, 'ChangeOrIfContinueToMultiContinueRector') !== false) {\n    exit(\"Remove deprecated ChangeOrIfContinueToMultiContinueRector from rector.php before running rector.\\n\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Register rules via sets instead of one-by-one class names so deprecations cannot linger.","Grep the config for 'EarlyReturn\\\\Rector' after upgrading rector; all three EarlyReturn rules in that namespace are deprecated throwers.","Run rector on a small sample directory first when upgrading versions, so a stale rule fails fast in a cheap place."],"tags":["rector","php","deprecated-rule","static-analysis","config"],"backgroundTag":"deprecated-api-invoked","analyzedSha":"408fcb0ff1833e3d26cbc9b04c23a77565814a16","analyzedAt":"2026-08-21T05:11:02.643Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}