public function otherwise(callable $onRejected) { return $this->then(null, function ($reason) use($onRejected) { if (!_checkTypehint($onRejected, $reason)) { return new RejectedPromise($reason); } return $onRejected($reason); }); }