Skip to content

Commit 82ede40

Browse files
committed
more tests
1 parent 81c7866 commit 82ede40

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tests/PHPStan/Analyser/nsrt/bug-11928.php

+8-1
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ function doFoo()
1717

1818
/**
1919
* @param array<1|2|3, 4|5|6> $unionKeyedArray
20+
* @param 4|5 $fourOrFive
2021
* @return void
2122
*/
22-
function doFooStrings($unionKeyedArray) {
23+
function doFooStrings($unionKeyedArray, $fourOrFive) {
2324
$a = [2 => 'hi', 3 => '123', 'xy' => 5];
2425
$keys = array_keys($a, 1);
2526
assertType("list<2|3|'xy'>", $keys);
@@ -30,6 +31,12 @@ function doFooStrings($unionKeyedArray) {
3031
$keys = array_keys($unionKeyedArray, 1);
3132
assertType("list<1|2|3>", $keys); // could be array{}
3233

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+
3340
$keys = array_keys($unionKeyedArray);
3441
assertType("list<1|2|3>", $keys);
3542
}

0 commit comments

Comments
 (0)