From 7caaa648257463398484a617207d28ebd788fa9f Mon Sep 17 00:00:00 2001 From: Brown Date: Tue, 2 Jun 2020 13:27:17 -0400 Subject: [PATCH] =?UTF-8?q?Fix=20#3418=20-=20don=E2=80=99t=20override=20wi?= =?UTF-8?q?th=20send=20type=20when=20@psalm-yield=20is=20given?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Internal/Analyzer/Statements/Expression/YieldAnalyzer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/YieldAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/YieldAnalyzer.php index 5412b2b4d..9dc3583dc 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/YieldAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/YieldAnalyzer.php @@ -186,7 +186,7 @@ class YieldAnalyzer $storage = $source->getFunctionLikeStorage($statements_analyzer); - if ($storage->return_type) { + if ($storage->return_type && !$yield_type) { foreach ($storage->return_type->getAtomicTypes() as $atomic_return_type) { if ($atomic_return_type instanceof Type\Atomic\TNamedObject && $atomic_return_type->value === 'Generator'