mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
Fix #485 when return type is a generator
This commit is contained in:
parent
1ae58f0386
commit
24e03edefa
@ -235,6 +235,7 @@ class ReturnChecker
|
||||
} else {
|
||||
if ($storage->signature_return_type
|
||||
&& !$storage->signature_return_type->isVoid()
|
||||
&& !$storage->signature_return_type->isGenerator()
|
||||
) {
|
||||
if (IssueBuffer::accepts(
|
||||
new InvalidReturnStatement(
|
||||
|
@ -271,6 +271,18 @@ class Php70Test extends TestCase
|
||||
new B();
|
||||
}',
|
||||
],
|
||||
'generatorVoidReturn' => [
|
||||
'<?php
|
||||
/**
|
||||
* @return Generator
|
||||
*/
|
||||
function generator2() : Generator {
|
||||
if (rand(0,1)) {
|
||||
return;
|
||||
}
|
||||
yield 2;
|
||||
}',
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user