1111 */
1212function test (array $ array , int $ id ): void {
1313 $ array [$ id ]['state ' ] = 'foo ' ;
14+ // only one element was set to 'foo', not all of them.
1415 assertType ("non-empty-array<int, array{state: 'foo'}> " , $ array );
1516}
1617
@@ -19,6 +20,7 @@ function test(array $array, int $id): void {
1920 */
2021function testMaybe (array $ array , int $ id ): void {
2122 $ array [$ id ]['state ' ] = 'foo ' ;
23+ // only one element was set to 'foo', not all of them.
2224 assertType ("non-empty-array<int, array{state: 'foo'}> " , $ array );
2325}
2426
@@ -27,6 +29,7 @@ function testMaybe(array $array, int $id): void {
2729 */
2830function testUnionValue (array $ array , int $ id ): void {
2931 $ array [$ id ]['state ' ] = 'foo ' ;
32+ // only one element was set to 'foo', not all of them.
3033 assertType ("non-empty-array<int, array{state: 'foo'}> " , $ array );
3134}
3235
@@ -35,6 +38,7 @@ function testUnionValue(array $array, int $id): void {
3538 */
3639function testUnionArray (array $ array , int $ id ): void {
3740 $ array [$ id ]['state ' ] = 'foo ' ;
41+ // only one element was set to 'foo', not all of them.
3842 assertType ("non-empty-array<int, array{foo?: int, state: 'foo'}> " , $ array );
3943}
4044
0 commit comments