From 298357f76027ad346546de363927f957aa4871f2 Mon Sep 17 00:00:00 2001 From: Bob Weinand Date: Sat, 13 Jun 2015 18:37:04 +0200 Subject: [PATCH] =?UTF-8?q?We=20need=20to=20check=20for=20Generator::getRe?= =?UTF-8?q?turn()=20in=20=E2=89=A5=20PHP=207?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/functions.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/functions.php b/lib/functions.php index 85ba927..5347677 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -563,7 +563,13 @@ function resolve(\Generator $generator, Reactor $reactor = null, callable $promi function __coroutineAdvance($cs) { try { if (!$cs->generator->valid()) { - $cs->promisor->succeed($cs->returnValue); + 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();