diff --git a/src/Psalm/Checker/Statements/Expression/CallChecker.php b/src/Psalm/Checker/Statements/Expression/CallChecker.php index 092e2a3b2..576bab4c2 100644 --- a/src/Psalm/Checker/Statements/Expression/CallChecker.php +++ b/src/Psalm/Checker/Statements/Expression/CallChecker.php @@ -367,7 +367,7 @@ class CallChecker return false; } - if (!isset($args[2]) || !isset($args[3])) { + if (!isset($args[2])) { return; } @@ -381,6 +381,10 @@ class CallChecker return false; } + if (!isset($args[3])) { + return; + } + $replacement_arg = $args[3]->value; if (ExpressionChecker::analyze( diff --git a/tests/FunctionCallTest.php b/tests/FunctionCallTest.php index 82333bb75..4dd6e219f 100644 --- a/tests/FunctionCallTest.php +++ b/tests/FunctionCallTest.php @@ -913,7 +913,9 @@ class FunctionCallTest extends TestCase $a = [1, 2, 3]; $c = $a; $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' => [ '$a' => 'array', '$b' => 'array{0:string, 1:string, 2:string}',