Skip to content

Commit 222a4ff

Browse files
committed
Regression test
1 parent 94e6e46 commit 222a4ff

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

tests/PHPStan/Rules/DeadCode/UnreachableStatementRuleTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ public function testRule(): void
4343
'Unreachable statement - code above always terminates.',
4444
71,
4545
],
46+
[
47+
'Unreachable statement - code above always terminates.',
48+
135,
49+
],
4650
]);
4751
}
4852

tests/PHPStan/Rules/DeadCode/data/unreachable.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,25 @@ private function somethingAboutDateTime(\DateTime $dt): bool
114114
}
115115

116116
}
117+
118+
class LastElseIf
119+
{
120+
121+
/**
122+
* @param 'a'|'b'|'c' $s
123+
* @return void
124+
*/
125+
public function doFoo(string $s): void
126+
{
127+
if ($s === 'a') {
128+
return;
129+
} elseif ($s === 'b') {
130+
return;
131+
} elseif ($s === 'c') {
132+
return;
133+
}
134+
135+
echo "test";
136+
}
137+
138+
}

0 commit comments

Comments
 (0)