diff --git a/src/Psalm/Internal/PhpVisitor/Reflector/ExpressionScanner.php b/src/Psalm/Internal/PhpVisitor/Reflector/ExpressionScanner.php index 6e88891a2..2a6dbf71e 100644 --- a/src/Psalm/Internal/PhpVisitor/Reflector/ExpressionScanner.php +++ b/src/Psalm/Internal/PhpVisitor/Reflector/ExpressionScanner.php @@ -125,6 +125,10 @@ class ExpressionScanner } } + 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 64a17a53d..f0ca9bb1f 100644 --- a/tests/ClosureTest.php +++ b/tests/ClosureTest.php @@ -729,6 +729,12 @@ class ClosureTest extends TestCase [], '8.1' ], + 'FirstClassCallable:array_map' => [ + ' [], + [], + '8.1', + ], ]; } @@ -1171,9 +1177,8 @@ class ClosureTest extends TestCase 'error_message' => 'MixedAssignment', [], false, - '8.1' + '8.1', ], - ]; } }