From 6c62e46d152c7cebb6212acee1ab238b2c328939 Mon Sep 17 00:00:00 2001 From: Brown Date: Wed, 1 Jul 2020 19:18:01 -0400 Subject: [PATCH] Only emit one error for erroneous array_map string closure types --- .../Expression/Call/ArrayFunctionArgumentsAnalyzer.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArrayFunctionArgumentsAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArrayFunctionArgumentsAnalyzer.php index e0b919514..584133557 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArrayFunctionArgumentsAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArrayFunctionArgumentsAnalyzer.php @@ -700,6 +700,11 @@ class ArrayFunctionArgumentsAnalyzer return; } + // we pick up errors for string closures elsewhere + if ($method_id === 'array_map' && $closure_type instanceof Type\Atomic\TString) { + return; + } + foreach ($closure_params as $i => $closure_param) { if (!isset($array_arg_types[$i])) { continue;