diff --git a/src/Psalm/Internal/PhpVisitor/Reflector/ExpressionScanner.php b/src/Psalm/Internal/PhpVisitor/Reflector/ExpressionScanner.php index 6e88891a20a..2a6dbf71eb9 100644 --- a/src/Psalm/Internal/PhpVisitor/Reflector/ExpressionScanner.php +++ b/src/Psalm/Internal/PhpVisitor/Reflector/ExpressionScanner.php @@ -125,6 +125,10 @@ private static function registerClassMapFunctionCall( } } + if ($node->isFirstClassCallable()) { + return; + } + if ($function_id === 'define') { $first_arg_value = isset($node->getArgs()[0]) ? $node->getArgs()[0]->value : null; $second_arg_value = isset($node->getArgs()[1]) ? $node->getArgs()[1]->value : null; diff --git a/tests/ClosureTest.php b/tests/ClosureTest.php index 64a17a53d28..f0ca9bb1fe5 100644 --- a/tests/ClosureTest.php +++ b/tests/ClosureTest.php @@ -729,6 +729,12 @@ public static function __callStatic(string $name, array $args): mixed { [], '8.1' ], + 'FirstClassCallable:array_map' => [ + ' [], + [], + '8.1', + ], ]; } @@ -1171,9 +1177,8 @@ public static function __callStatic(string $name, array $args): mixed { 'error_message' => 'MixedAssignment', [], false, - '8.1' + '8.1', ], - ]; } }