Repository navigation
Commit 2417780
committed
[DeadCode] Skip RemoveDeadIfBlockRector on empty if with elseif and trailing else
An empty if body followed by elseif and else was merged into
"if (!cond && elseifCond) {...} else {...}". When the original if
condition was true, the negated condition made the else branch run,
which the empty if body never did. Keep such code unchanged.
Fixes rectorphp/rector#9884
Claude-Session: https://claude.ai/code/session_01MszFhfN8nK7KR3mBjda8P21 parent 3bdc4c6 commit 2417780
2 files changed
Lines changed: 6 additions & 20 deletions
File tree
- rules-tests/DeadCode/Rector/If_/RemoveDeadIfBlockRector/Fixture
- rules/DeadCode/Rector/If_
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
134 | 140 | | |
135 | 141 | | |
136 | 142 | | |
| |||
0 commit comments