From 884d51067e996d5b292e467ccbbcea4daa7ebb4d Mon Sep 17 00:00:00 2001 From: simonbuehler Date: Tue, 19 Jan 2021 10:44:28 +0100 Subject: [PATCH] Implement JsonSerializable when beeing part of e.g. array the FullfilledPromise is not serialized, this will return the value now --- src/Internal/FulfilledPromise.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Internal/FulfilledPromise.php b/src/Internal/FulfilledPromise.php index e95d5aa4..651ec536 100644 --- a/src/Internal/FulfilledPromise.php +++ b/src/Internal/FulfilledPromise.php @@ -2,6 +2,7 @@ namespace React\Promise\Internal; +use JsonSerializable; use React\Promise\Promise; use React\Promise\PromiseInterface; use function React\Promise\enqueue; @@ -11,7 +12,7 @@ /** * @internal */ -final class FulfilledPromise implements PromiseInterface +final class FulfilledPromise implements PromiseInterface , JsonSerializable { private $value; @@ -77,4 +78,9 @@ public function always(callable $onFulfilledOrRejected): PromiseInterface public function cancel(): void { } + + public function jsonSerialize() + { + return $this->value; + } }