File tree 2 files changed +13
-2
lines changed
src/Psalm/Internal/Analyzer/Statements/Expression
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(
67
67
) {
68
68
$ yield_from_type = $ atomic_type ->type_params [3 ];
69
69
} elseif ($ atomic_type instanceof TArray) {
70
- $ yield_from_type = $ atomic_type -> type_params [ 1 ] ;
70
+ $ yield_from_type = Type:: getNull () ;
71
71
} elseif ($ atomic_type instanceof TKeyedArray) {
72
- $ yield_from_type = $ atomic_type -> getGenericValueType ();
72
+ $ yield_from_type = Type:: getNull ();
73
73
}
74
74
} else {
75
75
$ yield_from_type = Type::getMixed ();
Original file line number Diff line number Diff line change @@ -184,6 +184,17 @@ function foo() : Generator {
184
184
takesString($s);
185
185
} ' ,
186
186
],
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
+ ],
187
198
'expectNonNullableTypeWithYield ' => [
188
199
'code ' => '<?php
189
200
function example() : Generator {
You can’t perform that action at this time.
0 commit comments