Skip to content

Commit 6ed62e8

Browse files
committed
Update array-combine-php8.php
1 parent cf5587e commit 6ed62e8

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/PHPStan/Analyser/nsrt/array-combine-php8.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,19 @@ function withUnionConstArrays(): void
8383
assertType("array{1: 'avocado'}|array{2: 'apple', 3: 'banana'}", array_combine($a, $b));
8484
}
8585

86+
function withUnionConstArraysDifferentKeyValueCount(): void
87+
{
88+
if (rand(0, 1)) {
89+
$a = [1];
90+
$b = [];
91+
} else {
92+
$a = ["2", "3"];
93+
$b = ['apple', 'banana'];
94+
}
95+
96+
assertType("*NEVER*", array_combine($a, $b));
97+
}
98+
8699
/**
87100
* @param non-empty-array<int, 'foo'|'bar'|'baz'> $a
88101
* @param non-empty-array<int, 'apple'|'avocado'|'banana'> $b

0 commit comments

Comments
 (0)