mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
Fix closure return type inference
This commit is contained in:
parent
820bd95d8b
commit
f88c7c1ec5
@ -583,7 +583,7 @@ class ReturnAnalyzer
|
||||
Context $context
|
||||
): void {
|
||||
// if not returning from inside of a function, return
|
||||
if (!$context->calling_method_id) {
|
||||
if (!$context->calling_method_id && !$context->calling_function_id) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -594,7 +594,10 @@ class ReturnAnalyzer
|
||||
|
||||
$parent_fn_storage = $statements_analyzer
|
||||
->getCodebase()
|
||||
->getFunctionLikeStorage($statements_analyzer, $context->calling_method_id);
|
||||
->getFunctionLikeStorage(
|
||||
$statements_analyzer,
|
||||
$context->calling_function_id ?: $context->calling_method_id
|
||||
);
|
||||
|
||||
if ($parent_fn_storage->return_type === null) {
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user