Skip to content

Commit c1cfff7

Browse files
committed
Test that RemoveDeadIfBlock preserves calls
Add a test case to ensure that RemoveDeadIfBlockRector does not remove function calls in if conditions.
1 parent ea69bfb commit c1cfff7

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

rules-tests/DeadCode/Rector/If_/RemoveDeadIfBlockRector/Fixture/side_effect_checks.php.inc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ class SideEffectChecks
1414

1515
if (5 + 10) {
1616
}
17+
18+
if ($this->someCall()) {
19+
}
20+
21+
if (false) {
22+
} elseif ($this->anotherCall()) {
23+
}
1724
}
1825
}
1926

@@ -27,6 +34,11 @@ class SideEffectChecks
2734
{
2835
public function run()
2936
{
37+
if ($this->someCall()) {
38+
}
39+
40+
if (!false && $this->anotherCall()) {
41+
}
3042
}
3143
}
3244

0 commit comments

Comments
 (0)