1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-22 05:41:20 +01:00

Don’t coerce literal values

Fixes #2982
This commit is contained in:
Matthew Brown 2020-03-17 16:16:58 -04:00
parent 951b943c38
commit da170efb65
2 changed files with 11 additions and 0 deletions

View File

@ -3119,6 +3119,7 @@ class CallAnalyzer
&& !($function_param->is_variadic xor $unpack)
&& $cased_method_id !== 'echo'
&& $cased_method_id !== 'print'
&& $input_type->from_docblock
&& (!$in_call_map || $context->strict_types)
) {
self::coerceValueAfterGatekeeperArgument(

View File

@ -100,6 +100,16 @@ class ArgTest extends TestCase
function f(DateTime $d, int $a): void {}
f(...$a);',
],
'unpackWithoutAlteringArray' => [
'<?php
function takeVariadicInts(int ...$inputs): void {}
$a = [3, 5, 7];
takeVariadicInts(...$a);',
[
'$a' => 'array{0: int, 1: int, 2: int}'
]
],
];
}