1
0
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:
Aaron Piotrowski 2021-12-09 19:02:58 -06:00
parent d5519fc53a
commit 3c5e99ed1e
No known key found for this signature in database
GPG Key ID: ADD1EF783EDE9EEB

View File

@ -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) {