Skip to content

Commit 528fa76

Browse files
committed
Added regression test
1 parent 91f823b commit 528fa76

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace PR5447Regression;
6+
7+
use function PHPStan\Testing\assertType;
8+
9+
class Foo
10+
{
11+
12+
public function doFoo(): void
13+
{
14+
$device = $this->nullable();
15+
if ($device === null) {
16+
$device = 1;
17+
try {
18+
$device = $this->throwsException();
19+
} catch (\Exception) {
20+
$device = $this->nullable();
21+
assertType('int|null', $device);
22+
}
23+
}
24+
}
25+
26+
public function nullable(): ?int
27+
{
28+
29+
}
30+
31+
/** @throws \Exception */
32+
private function throwsException(): int
33+
{
34+
35+
}
36+
37+
}

0 commit comments

Comments
 (0)