1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 04:45:20 +01:00

Fix #58 - treat callmap args correctly when evaluating variadic

This commit is contained in:
Matthew Brown 2017-01-15 13:16:36 -05:00
parent 2e4996e562
commit 1bf2139149
2 changed files with 7 additions and 4 deletions

View File

@ -1305,10 +1305,11 @@ abstract class FunctionLikeChecker extends SourceChecker implements StatementsSo
}
foreach ($args as $argument_offset => $arg) {
if (count($possible_function_params) <= $argument_offset &&
(!$last_param || substr($last_param->name, 0, 3) !== '...')
) {
$all_args_match = false;
if ($argument_offset >= count($possible_function_params)) {
if (!$last_param || !$last_param->is_variadic) {
$all_args_match = false;
}
break;
}

View File

@ -484,6 +484,8 @@ class TypeReconciliationTest extends PHPUnit_Framework_TestCase
$a = min(0, 1);
$b = min([0, 1]);
$c = min("a", "b");
$d = min(1, 2, 3, 4);
$e = min(1, 2, 3, 4, 5);
');
$file_checker = new FileChecker('somefile.php', $this->project_checker, $stmts);