diff --git a/src/Psalm/Internal/Analyzer/Statements/ExpressionAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/ExpressionAnalyzer.php index 799ecb244..6ee305f97 100644 --- a/src/Psalm/Internal/Analyzer/Statements/ExpressionAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/ExpressionAnalyzer.php @@ -1928,16 +1928,16 @@ class ExpressionAnalyzer $classlike_storage = $codebase->classlike_storage_provider->get($expression_atomic_type->value); if ($classlike_storage->yield) { - $yield_type = clone $classlike_storage->yield; - if ($expression_atomic_type instanceof Type\Atomic\TGenericObject) { $yield_type = PropertyFetchAnalyzer::localizePropertyType( $codebase, - $yield_type, + clone $classlike_storage->yield, $expression_atomic_type, $classlike_storage, $classlike_storage ); + } else { + $yield_type = Type::getMixed(); } $expression_type->substitute($expression_type, $yield_type);