@@ -282,7 +282,7 @@ protected function testOptionalKeysInUnion($row): void
282
282
/**
283
283
* @param array{string}|array{0: int, 1?: string|null} $row
284
284
*/
285
- protected function testOptionalKeysInTaggedUnion ($ row ): void
285
+ protected function testOptionalKeysInListsOfTaggedUnion ($ row ): void
286
286
{
287
287
if (count ($ row ) === 0 ) {
288
288
assertType ('*NEVER* ' , $ row );
@@ -309,4 +309,34 @@ protected function testOptionalKeysInTaggedUnion($row): void
309
309
}
310
310
}
311
311
312
+ /**
313
+ * @param array{string}|array{0: int, 3?: string|null} $row
314
+ */
315
+ protected function testOptionalKeysInUnionArray ($ row ): void
316
+ {
317
+ if (count ($ row ) === 0 ) {
318
+ assertType ('*NEVER* ' , $ row );
319
+ } else {
320
+ assertType ('array{0: int, 3?: string|null}|array{string} ' , $ row );
321
+ }
322
+
323
+ if (count ($ row ) === 1 ) {
324
+ assertType ('array{0: int, 3?: string|null}|array{string} ' , $ row );
325
+ } else {
326
+ assertType ('array{0: int, 3?: string|null} ' , $ row );
327
+ }
328
+
329
+ if (count ($ row ) === 2 ) {
330
+ assertType ('array{0: int, 3?: string|null} ' , $ row );
331
+ } else {
332
+ assertType ('array{0: int, 3?: string|null}|array{string} ' , $ row );
333
+ }
334
+
335
+ if (count ($ row ) === 3 ) {
336
+ assertType ('*NEVER* ' , $ row );
337
+ } else {
338
+ assertType ('array{0: int, 3?: string|null}|array{string} ' , $ row );
339
+ }
340
+ }
341
+
312
342
}
0 commit comments