File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed
src/Psalm/Internal/Analyzer/Statements/Expression Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -67,9 +67,9 @@ public static function analyze(
6767 ) {
6868 $ yield_from_type = $ atomic_type ->type_params [3 ];
6969 } elseif ($ atomic_type instanceof TArray) {
70- $ yield_from_type = $ atomic_type -> type_params [ 1 ] ;
70+ $ yield_from_type = Type:: getNull () ;
7171 } elseif ($ atomic_type instanceof TKeyedArray) {
72- $ yield_from_type = $ atomic_type -> getGenericValueType ();
72+ $ yield_from_type = Type:: getNull ();
7373 }
7474 } else {
7575 $ yield_from_type = Type::getMixed ();
Original file line number Diff line number Diff line change @@ -184,6 +184,17 @@ function foo() : Generator {
184184 takesString($s);
185185 } ' ,
186186 ],
187+ 'returnTypeArr ' => [
188+ 'code ' => '<?php
189+ function foo() : Generator {
190+ $result = yield from [2];
191+ /** @psalm-check-type-exact $result = null */;
192+ }
193+ function foo2() : Generator {
194+ $result = yield from [];
195+ /** @psalm-check-type-exact $result = null */;
196+ } ' ,
197+ ],
187198 'expectNonNullableTypeWithYield ' => [
188199 'code ' => '<?php
189200 function example() : Generator {
You can’t perform that action at this time.
0 commit comments