Skip to content

Commit 9b64695

Browse files
SanderMullerclaude
andcommitted
Do not assert the type of an unpacked array_map() arg
The test asserted array{4, 5, 6} for the parameter of an unpacked arg. At runtime the parameter gets 4, 5 and 6. PHPStan already inferred this wrong type before this change, so the test must not lock it in. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent f7a30e1 commit 9b64695

1 file changed

Lines changed: 0 additions & 9 deletions

File tree

‎tests/PHPStan/Analyser/nsrt/bug-13217.php‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,6 @@ public function sizeRange(array $maybe): void
5656
}, $maybe, $maybe);
5757
}
5858

59-
public function unpacked(): void
60-
{
61-
// the closure gets one parameter per arg here, not one per unpacked array
62-
array_map(function ($a, $b) {
63-
assertType('1|2|3', $a);
64-
assertType('array{4, 5, 6}', $b);
65-
}, [1, 2, 3], ...[[4, 5, 6]]);
66-
}
67-
6859
public function singleArray(): void
6960
{
7061
array_map(function ($a) {

0 commit comments

Comments
 (0)