1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-26 20:34:47 +01:00

Fix #2221 - variadic args are lists

This commit is contained in:
Brown 2019-10-10 17:46:20 -04:00
parent 67b32f463e
commit 3658771bff
2 changed files with 15 additions and 4 deletions

View File

@ -894,10 +894,7 @@ abstract class FunctionLikeAnalyzer extends SourceAnalyzer implements Statements
if ($function_param->is_variadic) {
$var_type = new Type\Union([
new Type\Atomic\TArray([
Type::getInt(),
$param_type,
]),
new Type\Atomic\TList($param_type),
]);
}

View File

@ -1236,6 +1236,20 @@ class ArrayAssignmentTest extends TestCase
return $arr;
}',
],
'unpackedArgIsList' => [
'<?php
final class Values
{
/**
* @psalm-var list<int>
*/
private $ints = [];
public function set(int ...$ints): void {
$this->ints = $ints;
}
}'
],
];
}