mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 04:45:20 +01:00
Revert reorder of getting method return type and checking args
Skipping checking args for first-class callables, but fixes handling of other methods.
This commit is contained in:
parent
d5519fc53a
commit
3c5e99ed1e
@ -196,6 +196,19 @@ class ExistingAtomicMethodCallAnalyzer extends CallAnalyzer
|
||||
);
|
||||
}
|
||||
|
||||
$is_first_class_callable = $stmt->isFirstClassCallable();
|
||||
|
||||
if (!$is_first_class_callable && self::checkMethodArgs(
|
||||
$method_id,
|
||||
$args,
|
||||
$template_result,
|
||||
$context,
|
||||
new CodeLocation($source, $stmt_name),
|
||||
$statements_analyzer
|
||||
) === false) {
|
||||
return Type::getMixed();
|
||||
}
|
||||
|
||||
$declaring_method_id = $codebase->methods->getDeclaringMethodId($method_id);
|
||||
|
||||
$return_type_candidate = MethodCallReturnTypeFetcher::fetch(
|
||||
@ -214,21 +227,10 @@ class ExistingAtomicMethodCallAnalyzer extends CallAnalyzer
|
||||
$template_result
|
||||
);
|
||||
|
||||
if ($stmt->isFirstClassCallable()) {
|
||||
if ($is_first_class_callable) {
|
||||
return $return_type_candidate;
|
||||
}
|
||||
|
||||
if (self::checkMethodArgs(
|
||||
$method_id,
|
||||
$args,
|
||||
$template_result,
|
||||
$context,
|
||||
new CodeLocation($source, $stmt_name),
|
||||
$statements_analyzer
|
||||
) === false) {
|
||||
return Type::getMixed();
|
||||
}
|
||||
|
||||
$in_call_map = InternalCallMapHandler::inCallMap((string) ($declaring_method_id ?? $method_id));
|
||||
|
||||
if (!$in_call_map) {
|
||||
|
Loading…
Reference in New Issue
Block a user