mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 04:45:20 +01:00
Handle first class callable on unknown functions
This commit is contained in:
parent
4729eb004a
commit
a598efb4ab
@ -484,6 +484,8 @@ class FunctionCallAnalyzer extends CallAnalyzer
|
||||
$is_maybe_root_function = !$function_name instanceof PhpParser\Node\Name\FullyQualified
|
||||
&& count($function_name->parts) === 1;
|
||||
|
||||
$args = $stmt->isFirstClassCallable() ? [] : $stmt->getArgs();
|
||||
|
||||
if (!$function_call_info->in_call_map) {
|
||||
$predefined_functions = $codebase->config->getPredefinedFunctions();
|
||||
$is_predefined = isset($predefined_functions[strtolower($original_function_id)])
|
||||
@ -495,11 +497,10 @@ class FunctionCallAnalyzer extends CallAnalyzer
|
||||
$function_call_info->function_id,
|
||||
$code_location,
|
||||
$is_maybe_root_function
|
||||
) === false
|
||||
) {
|
||||
if (ArgumentsAnalyzer::analyze(
|
||||
) === false) {
|
||||
if ($args && ArgumentsAnalyzer::analyze(
|
||||
$statements_analyzer,
|
||||
$stmt->getArgs(),
|
||||
$args,
|
||||
null,
|
||||
null,
|
||||
true,
|
||||
|
@ -798,6 +798,10 @@ class ClosureTest extends TestCase
|
||||
'error_levels' => [],
|
||||
'8.1'
|
||||
],
|
||||
'unknownFirstClassCallable' => [
|
||||
'<?php
|
||||
unknown(...);',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user