We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cf3bf63 commit c5a4140Copy full SHA for c5a4140
tests/PHPStan/Analyser/nsrt/bug-5128.php
@@ -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