mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 12:55:26 +01:00
Merge pull request #6790 from orklah/fix_yield
This commit is contained in:
commit
81ca05f3ab
@ -343,7 +343,8 @@ class ReturnTypeCollector
|
||||
|
||||
if ($stmt instanceof PhpParser\Node\Expr\MethodCall
|
||||
|| $stmt instanceof PhpParser\Node\Expr\FuncCall
|
||||
|| $stmt instanceof PhpParser\Node\Expr\StaticCall) {
|
||||
|| $stmt instanceof PhpParser\Node\Expr\StaticCall
|
||||
|| $stmt instanceof PhpParser\Node\Expr\New_) {
|
||||
$yield_types = [];
|
||||
|
||||
foreach ($stmt->getArgs() as $arg) {
|
||||
|
@ -286,6 +286,15 @@ class GeneratorTest extends TestCase
|
||||
'$iterator' => 'NoRewindIterator<int, string>',
|
||||
]
|
||||
],
|
||||
'detectYieldInNew' => [
|
||||
'<?php
|
||||
/** @psalm-suppress MissingClosureReturnType */
|
||||
$_a = function() { return new RuntimeException(yield "a"); };
|
||||
',
|
||||
'assertions' => [
|
||||
'$_a' => 'pure-Closure():Generator<int, "a", mixed, RuntimeException>',
|
||||
]
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user