Skip to content

Commit f868b58

Browse files
committed
added regression test
1 parent 3ba48c9 commit f868b58

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

tests/PHPStan/Rules/DeadCode/UnreachableStatementRuleTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,18 @@ public function testMultipleUnreachable(): void
241241
]);
242242
}
243243

244+
#[RequiresPhp('>= 8.1')]
245+
public function testBug11909(): void
246+
{
247+
$this->treatPhpDocTypesAsCertain = false;
248+
$this->analyse([__DIR__ . '/data/bug-11909.php'], [
249+
[
250+
'Unreachable statement - code above always terminates.',
251+
10,
252+
],
253+
]);
254+
}
255+
244256
#[RequiresPhp('>= 8.1')]
245257
public function testBug13232a(): void
246258
{
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace Bug11909;
4+
5+
function doFoo(): never {
6+
throw new LogicException("throws");
7+
}
8+
9+
echo doFoo();
10+
echo "hello";

0 commit comments

Comments
 (0)