Skip to content

Commit c5a4140

Browse files
phpstan-botVincentLanglet
authored andcommitted
Add regression test for #5128
Closes phpstan/phpstan#5128
1 parent cf3bf63 commit c5a4140

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace Bug5128;
4+
5+
use function PHPStan\Testing\assertType;
6+
7+
/**
8+
* @param array{a: string}|array{b: string} $array
9+
*/
10+
function a(array $array): string {
11+
if (isset($array['a'])) {
12+
assertType('array{a: string}', $array);
13+
return $array['a'];
14+
}
15+
16+
assertType('array{b: string}', $array);
17+
return $array['b'];
18+
}

0 commit comments

Comments
 (0)