1
0
Fork 0
mirror of synced 2024-07-05 06:31:08 +12:00

Fix chained promises

This commit is contained in:
Jake Barnby 2022-07-18 18:47:08 +12:00
parent 410d9b0f0c
commit 31081b01cb

View file

@ -3,6 +3,7 @@
namespace Appwrite\GraphQL\Promises; namespace Appwrite\GraphQL\Promises;
use GraphQL\Error\InvariantViolation; use GraphQL\Error\InvariantViolation;
use GraphQL\Executor\Promise\Promise;
use GraphQL\Utils\Utils; use GraphQL\Utils\Utils;
use Swoole\Coroutine\Channel; use Swoole\Coroutine\Channel;
@ -111,7 +112,7 @@ class CoroutinePromise
usleep(25000); usleep(25000);
} }
$callable = $this->isFulfilled() ? $onFulfilled : $onRejected; $callable = $this->isFulfilled() ? $onFulfilled : $onRejected;
if (!is_callable($callable)) { if (!\is_callable($callable)) {
$resolve($this->result); $resolve($this->result);
return; return;
} }
@ -178,7 +179,7 @@ class CoroutinePromise
*/ */
private function setResult(mixed $value): void private function setResult(mixed $value): void
{ {
if (!$value instanceof CoroutinePromise) { if (!$value instanceof Promise) {
$this->result = $value; $this->result = $value;
return; return;
} }