Icicle\Awaitable\Internal\FulfilledAwaitable::then PHP Method

then() public method

public then ( callable $onFulfilled = null, callable $onRejected = null ) : Awaitable
$onFulfilled callable
$onRejected callable
return Awaitable
    public function then(callable $onFulfilled = null, callable $onRejected = null) : Awaitable
    {
        if (null === $onFulfilled) {
            return $this;
        }
        try {
            $result = $onFulfilled($this->value);
        } catch (Throwable $exception) {
            return new RejectedAwaitable($exception);
        }
        if (!$result instanceof Awaitable) {
            $result = new self($result);
        }
        return $result;
    }