diff --git a/src/Psalm/Checker/Statements/Expression/CallChecker.php b/src/Psalm/Checker/Statements/Expression/CallChecker.php index 609a9bf1b..3230ba3b3 100644 --- a/src/Psalm/Checker/Statements/Expression/CallChecker.php +++ b/src/Psalm/Checker/Statements/Expression/CallChecker.php @@ -1481,7 +1481,7 @@ class CallChecker } } - if (!$has_valid_method) { + if (!$has_valid_method && !$param_type->hasString() && !$param_type->hasArray()) { if (MethodChecker::checkMethodExists( $project_checker, $non_existent_method_ids[0], @@ -1493,7 +1493,7 @@ class CallChecker } } } else { - if (self::checkFunctionExists( + if (!$param_type->hasString() && !$param_type->hasArray() && self::checkFunctionExists( $statements_checker, $function_id, $code_location, diff --git a/tests/ClosureTest.php b/tests/ClosureTest.php index 5ca8639a6..c8ec7b140 100644 --- a/tests/ClosureTest.php +++ b/tests/ClosureTest.php @@ -206,6 +206,15 @@ class ClosureTest extends TestCase new A([new A, new A]);', ], + 'possiblyUndefinedFunction' => [ + '