Skip to content

Commit 3c57bce

Browse files
committed
Update bug-13857.php
1 parent b435be3 commit 3c57bce

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,11 @@ function testUnionArray(array $array, int $id): void {
4141
// only one element was set to 'foo', not all of them.
4242
assertType("non-empty-array<int, non-empty-array{foo?: int, state?: string}>", $array);
4343
}
44+
45+
/**
46+
* @param array<int, array{state: string}|array{foo: int}> $array
47+
*/
48+
function testUnionArrayDifferentType(array $array, int $id): void {
49+
$array[$id]['state'] = true;
50+
assertType("non-empty-array<int, array{state: string}|non-empty-array{foo?: int, state?: true}>", $array);
51+
}

0 commit comments

Comments
 (0)