diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MissingMethodCallHandler.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MissingMethodCallHandler.php index 9f2296c1cc0..d62531d00ce 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MissingMethodCallHandler.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MissingMethodCallHandler.php @@ -188,6 +188,17 @@ public static function handleMissingOrMagicMethod( ) ?: Type::getMixed(); } + $return_type_candidate = \Psalm\Internal\Type\TypeExpander::expandUnion( + $codebase, + $return_type_candidate, + $fq_class_name, + $fq_class_name, + $class_storage->parent_class, + true, + false, + $class_storage->final + ); + if (!$result->return_type) { $result->return_type = $return_type_candidate; } else {