public function otherwise(callable $onRejected) { if (!_checkTypehint($onRejected, $this->reason)) { return $this; } return $this->then(null, $onRejected); }
public function otherwise(callable $onRejected) { return $this->then(null, function ($reason) use($onRejected) { if (!_checkTypehint($onRejected, $reason)) { return new RejectedPromise($reason); } return $onRejected($reason); }); }
/** @test */ public function shouldAcceptStaticClassCallbackWithoutTypehint() { $this->assertTrue(_checkTypehint(['React\\Promise\\TestCallbackWithoutTypehintClass', 'testCallbackStatic'], new \InvalidArgumentException())); }