mirror of
https://github.com/danog/amp.git
synced 2024-11-30 04:29:08 +01:00
We need to check for Generator::getReturn() in ≥ PHP 7
This commit is contained in:
parent
8a8930c8fd
commit
298357f760
@ -563,7 +563,13 @@ function resolve(\Generator $generator, Reactor $reactor = null, callable $promi
|
||||
function __coroutineAdvance($cs) {
|
||||
try {
|
||||
if (!$cs->generator->valid()) {
|
||||
if (isset($cs->returnValue)) {
|
||||
$cs->promisor->succeed($cs->returnValue);
|
||||
} elseif (PHP_MAJOR_VERSION >= 7) {
|
||||
$cs->promisor->succeed($cs->generator->getReturn());
|
||||
} else {
|
||||
$cs->promisor->succeed(null);
|
||||
}
|
||||
return;
|
||||
}
|
||||
$yielded = $cs->generator->current();
|
||||
|
Loading…
Reference in New Issue
Block a user