Skip to content

Commit 16cfec9

Browse files
SanderMullerclaude
authored andcommitted
Test an unpacked array that might not be a list
An array shape whose first key is optional might not be a list, so its values are not known by position. Only a list is expanded into one value per position. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 964d864 commit 16cfec9

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎tests/PHPStan/Analyser/nsrt/array-map-unpacked-args.php‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,14 @@ public function shorterUnpackedArray(): void
102102

103103
/**
104104
* @param list<int> $ints
105+
* @param array{0?: 1, 1: 2} $maybeList
105106
*/
106-
public function immediatelyInvoked(array $ints): void
107+
public function immediatelyInvoked(array $ints, array $maybeList): void
107108
{
109+
(function ($a) {
110+
assertType('1|2', $a);
111+
})(...$maybeList);
112+
108113
(function ($a, $b) {
109114
assertType('int', $a);
110115
assertType('int', $b);

0 commit comments

Comments
 (0)