Skip to content

Commit d9f98dc

Browse files
committed
New test for bug
1 parent 9c06f13 commit d9f98dc

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

tests/PHPStan/Rules/Exceptions/OverwrittenExitPointByFinallyRuleTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,4 +176,9 @@ public function testBug5627(): void
176176
]);
177177
}
178178

179+
public function testBug11906(): void
180+
{
181+
$this->analyse([__DIR__ . '/data/bug-11906.php'], []);
182+
}
183+
179184
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
namespace Bug11906;
4+
5+
declare(strict_types=1);
6+
7+
function func(): void {
8+
try {
9+
throw new LogicException('test');
10+
} catch (LogicException) {
11+
// This catch-block should cause line 7 to not be treated as an exit point
12+
} finally {
13+
if (getenv('FOO')) {
14+
return;
15+
}
16+
}
17+
}

0 commit comments

Comments
 (0)