From f132436af3c90cff8dcef852bd836546311036f3 Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 7 May 2020 21:48:26 +0000 Subject: composer updates 2 --- vendor/sabre/event/lib/coroutine.php | 52 ++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 29 deletions(-) (limited to 'vendor/sabre/event/lib/coroutine.php') diff --git a/vendor/sabre/event/lib/coroutine.php b/vendor/sabre/event/lib/coroutine.php index 750e8ab52..a6a2baf41 100644 --- a/vendor/sabre/event/lib/coroutine.php +++ b/vendor/sabre/event/lib/coroutine.php @@ -1,4 +1,6 @@ -valid()) { - $yieldedValue = $generator->current(); if ($yieldedValue instanceof Promise) { $yieldedValue->then( - function($value) use ($generator, &$advanceGenerator, &$lastYieldResult) { + function ($value) use ($generator, &$advanceGenerator) { $generator->send($value); $advanceGenerator(); }, - function(Throwable $reason) use ($generator, $advanceGenerator) { + function (Throwable $reason) use ($generator, $advanceGenerator) { $generator->throw($reason); $advanceGenerator(); } - )->otherwise(function(Throwable $reason) use ($promise) { + )->otherwise(function (Throwable $reason) use ($promise) { // This error handler would be called, if something in the // generator throws an exception, and it's not caught // locally. @@ -87,31 +88,25 @@ function coroutine(callable $gen) : Promise { // If the value was not a promise, we'll just let it pass through. $generator->send($yieldedValue); } - } // If the generator is at the end, and we didn't run into an exception, // We're grabbing the "return" value and fulfilling our top-level // promise with its value. - if (!$generator->valid() && $promise->state === Promise::PENDING) { - $returnValue = $generator->getReturn(); - - // The return value is a promise. - if ($returnValue instanceof Promise) { - $returnValue->then(function($value) use ($promise) { - $promise->fulfill($value); - }, function(Throwable $reason) { - $promise->reject($reason); - }); - } else { - - $promise->fulfill($returnValue); - - } - - + if (!$generator->valid() && Promise::PENDING === $promise->state) { + $returnValue = $generator->getReturn(); + + // The return value is a promise. + if ($returnValue instanceof Promise) { + $returnValue->then(function ($value) use ($promise) { + $promise->fulfill($value); + }, function (Throwable $reason) use ($promise) { + $promise->reject($reason); + }); + } else { + $promise->fulfill($returnValue); + } } - }; try { @@ -121,5 +116,4 @@ function coroutine(callable $gen) : Promise { } return $promise; - } -- cgit v1.2.3