Skip to content

Commit c698d4b

Browse files
committed
Consistent value when getting a key overlapping with unsealed extra keys
1 parent 655de38 commit c698d4b

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

‎tests/PHPStan/Analyser/nsrt/unsealed-array-shapes.php‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,3 +445,32 @@ function unsealedNarrowing(array $stringExtras, array $intExtras, array $open, a
445445
assertType('*NEVER*', $stringExtras);
446446
}
447447
}
448+
449+
class ConsistentKeyFetchWhenOverlappingWithUnsealedExtraKeys
450+
{
451+
452+
/**
453+
* @param array{1: string, 2: string, ...<int, int>} $array
454+
*/
455+
public function startDay(array $array): void
456+
{
457+
assertType('string', $array[1]);
458+
}
459+
460+
/**
461+
* @param array{1: string, 2: string, ...<int<0, max>, int>} $array
462+
*/
463+
public function startDay2(array $array): void
464+
{
465+
assertType('string', $array[1]);
466+
}
467+
468+
/**
469+
* @param array{1: string, 2: string, ...<int<0, 5>, int>} $array
470+
*/
471+
public function startDay3(array $array): void
472+
{
473+
assertType('string', $array[1]);
474+
}
475+
476+
}

0 commit comments

Comments
 (0)