diff --git a/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayReduceReturnTypeProvider.php b/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayReduceReturnTypeProvider.php index f743f9a22e1..3b38a8bf6ab 100644 --- a/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayReduceReturnTypeProvider.php +++ b/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayReduceReturnTypeProvider.php @@ -217,7 +217,14 @@ public static function getFunctionReturnType(FunctionReturnTypeProviderEvent $ev [$callable_fq_class_name, $method_name] = explode('::', $mapping_function_id_part); - if (in_array($callable_fq_class_name, ['self', 'static', 'parent'], true)) { + if (in_array($callable_fq_class_name, ['self', 'static'], true)) { + $callable_fq_class_name = $statements_source->getFQCLN(); + if ($callable_fq_class_name === null) { + continue; + } + } + + if ($callable_fq_class_name === 'parent') { continue; } diff --git a/tests/ArrayFunctionCallTest.php b/tests/ArrayFunctionCallTest.php index be479a702a9..49762af7e60 100644 --- a/tests/ArrayFunctionCallTest.php +++ b/tests/ArrayFunctionCallTest.php @@ -1325,6 +1325,28 @@ function (int $carry, int $item) : int { '$function_call_result' => 'int', ], ], + 'arrayReduceStaticMethods' => [ + ' [], + ], 'arrayReduceMixedReturn' => [ '