public function __construct(callable $resolver = null, callable $canceller = null)
{
$this->result = null;
$this->handlers = [];
$this->canceller = function ($reason = null) use($canceller) {
try {
return $canceller !== null && ($result = $canceller($reason)) instanceof self ? $result : $this;
} catch (Error $ex) {
} catch (Exception $ex) {
}
return $this;
};
$this->currentCancellations = 0;
$this->requiredCancellations = 0;
$this->mutate($resolver);
}