Skip to content

Commit

Permalink
Implement JsonSerializable
Browse files Browse the repository at this point in the history
when beeing part of e.g. array the FullfilledPromise is not serialized, this will return the value now
  • Loading branch information
simonbuehler committed Jan 19, 2021
1 parent 0845d29 commit 884d510
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Internal/FulfilledPromise.php
Expand Up @@ -2,6 +2,7 @@

namespace React\Promise\Internal;

use JsonSerializable;
use React\Promise\Promise;
use React\Promise\PromiseInterface;
use function React\Promise\enqueue;
Expand All @@ -11,7 +12,7 @@
/**
* @internal
*/
final class FulfilledPromise implements PromiseInterface
final class FulfilledPromise implements PromiseInterface , JsonSerializable
{
private $value;

Expand Down Expand Up @@ -77,4 +78,9 @@ public function always(callable $onFulfilledOrRejected): PromiseInterface
public function cancel(): void
{
}

public function jsonSerialize()
{
return $this->value;
}
}

0 comments on commit 884d510

Please sign in to comment.