src/AsyncTask.php
final function wrap($functionResult) {
        try {
            if($functionResult instanceof \Closure) {
                $functionResult = $functionResult();
            }
            
            if($functionResult instanceof \Throwable) {
                return $this->wrapUp(null, $functionResult);
            } elseif(!($functionResult instanceof \React\Promise\PromiseInterface)) {
                return $this->wrapUp($functionResult, null);
            }
            
            $functionResult->done(function ($val) {
                $this->wrapUp($val, null);
            }, function ($val) {
                $this->wrapUp(null, $val);
            });
        } catch (\Throwable $e) {
            $this->wrapUp(null, $e);
        }
    }
final function wrap($functionResult) {
        try {
            if($functionResult instanceof \Closure) {
                $functionResult = $functionResult();
            }
            
            if($functionResult instanceof \Throwable) {
                return $this->wrapUp(null, $functionResult);
            } elseif(!($functionResult instanceof \React\Promise\PromiseInterface)) {
                return $this->wrapUp($functionResult, null);
            }
            
            $functionResult->done(function ($val) {
                $this->wrapUp($val, null);
            }, function ($val) {
                $this->wrapUp(null, $val);
            });
        } catch (\Throwable $e) {
            $this->wrapUp(null, $e);
        }
    }
Wrapper for the function result. Closures get called. Promises get resolved and their resolve value get sent upstream to the pool.
@param mixed|\React\Promise\PromiseInterface|\Closure  $functionResult  Result must be serializable.
@return void
@codeCoverageIgnore