File tree 1 file changed +8
-1
lines changed
tests/PHPStan/Analyser/nsrt
1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -17,9 +17,10 @@ function doFoo()
17
17
18
18
/**
19
19
* @param array<1|2|3, 4|5|6> $unionKeyedArray
20
+ * @param 4|5 $fourOrFive
20
21
* @return void
21
22
*/
22
- function doFooStrings ($ unionKeyedArray ) {
23
+ function doFooStrings ($ unionKeyedArray, $ fourOrFive ) {
23
24
$ a = [2 => 'hi ' , 3 => '123 ' , 'xy ' => 5 ];
24
25
$ keys = array_keys ($ a , 1 );
25
26
assertType ("list<2|3|'xy'> " , $ keys );
@@ -30,6 +31,12 @@ function doFooStrings($unionKeyedArray) {
30
31
$ keys = array_keys ($ unionKeyedArray , 1 );
31
32
assertType ("list<1|2|3> " , $ keys ); // could be array{}
32
33
34
+ $ keys = array_keys ($ unionKeyedArray , 4 );
35
+ assertType ("list<1|2|3> " , $ keys );
36
+
37
+ $ keys = array_keys ($ unionKeyedArray , $ fourOrFive );
38
+ assertType ("list<1|2|3> " , $ keys );
39
+
33
40
$ keys = array_keys ($ unionKeyedArray );
34
41
assertType ("list<1|2|3> " , $ keys );
35
42
}
You can’t perform that action at this time.
0 commit comments