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

Fix #2925 - ignore null return type for array_replace_recursive

This commit is contained in:
Matthew Brown 2020-03-15 14:07:55 -04:00
parent 3ebb5a1142
commit 73badf59d1
2 changed files with 10 additions and 1 deletions

View File

@ -370,6 +370,15 @@ class FunctionAnalyzer extends FunctionLikeAnalyzer
}
}
switch ($call_map_key) {
case 'array_replace':
case 'array_replace_recursive':
if ($codebase->config->ignore_internal_nullable_issues) {
$call_map_return_type->ignore_nullable_issues = true;
}
break;
}
return $call_map_return_type;
}

View File

@ -394,7 +394,7 @@ return [
'array_rand' => ['int|string|array<int,int>|array<int,string>', 'input'=>'array', 'num_req'=>'int'],
'array_rand\'1' => ['int|string', 'input'=>'array'],
'array_reduce' => ['mixed', 'input'=>'array', 'callback'=>'callable(mixed,mixed):mixed', 'initial='=>'mixed'],
'array_replace' => ['array', 'arr1'=>'array', 'arr2'=>'array', '...args='=>'array'],
'array_replace' => ['?array', 'arr1'=>'array', 'arr2'=>'array', '...args='=>'array'],
'array_replace_recursive' => ['?array', 'arr1'=>'array', 'arr2'=>'array', '...args='=>'array'],
'array_reverse' => ['array', 'input'=>'array', 'preserve='=>'bool'],
'array_search' => ['int|string|false', 'needle'=>'mixed', 'haystack'=>'array', 'strict='=>'bool'],