We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 61b98ea commit 64793f6Copy full SHA for 64793f6
tests/PHPStan/Rules/Variables/data/bug-12364.php
@@ -17,3 +17,20 @@ function foo(): array {
17
assertType('string|null', $y); // <-- should be: null|string
18
var_dump($x);
19
var_dump($y); // <-- does exist
20
+
21
+/** @return array{xx: string, yy?: string} */
22
+function foo2(): array {
23
+ return [ 'xx' => 'foo' ];
24
+}
25
26
+if (rand(0, 1)) {
27
+ $xx = $yy = null;
28
+ assertType('null', $xx);
29
+ assertType('null', $yy);
30
31
32
+extract(foo2());
33
+assertType('string', $xx);
34
+assertType('string|null', $yy); // <-- should be: null|string
35
+var_dump($xx);
36
+var_dump($yy); // <-- does exist
0 commit comments