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

Fix #955 - always check third argument of array_splice

This commit is contained in:
Matt Brown 2018-08-24 16:12:07 -04:00
parent 0691763803
commit 4ef2aafdd8
2 changed files with 8 additions and 2 deletions

View File

@ -367,7 +367,7 @@ class CallChecker
return false; return false;
} }
if (!isset($args[2]) || !isset($args[3])) { if (!isset($args[2])) {
return; return;
} }
@ -381,6 +381,10 @@ class CallChecker
return false; return false;
} }
if (!isset($args[3])) {
return;
}
$replacement_arg = $args[3]->value; $replacement_arg = $args[3]->value;
if (ExpressionChecker::analyze( if (ExpressionChecker::analyze(

View File

@ -913,7 +913,9 @@ class FunctionCallTest extends TestCase
$a = [1, 2, 3]; $a = [1, 2, 3];
$c = $a; $c = $a;
$b = ["a", "b", "c"]; $b = ["a", "b", "c"];
array_splice($a, -1, 1, $b);', array_splice($a, -1, 1, $b);
$d = [1, 2, 3];
array_splice($d, -1, 1);',
'assertions' => [ 'assertions' => [
'$a' => 'array<int, string|int>', '$a' => 'array<int, string|int>',
'$b' => 'array{0:string, 1:string, 2:string}', '$b' => 'array{0:string, 1:string, 2:string}',