diff --git a/src/Deferred.php b/src/Deferred.php index 6bc40293..ef06069f 100644 --- a/src/Deferred.php +++ b/src/Deferred.php @@ -36,7 +36,7 @@ public function resolve($value = null) \call_user_func($this->resolveCallback, $value); } - public function reject($reason) + public function reject(\Throwable $reason) { $this->promise(); diff --git a/src/Promise.php b/src/Promise.php index 0d75bde3..f25d3667 100644 --- a/src/Promise.php +++ b/src/Promise.php @@ -129,7 +129,7 @@ private function resolve($value = null) $this->settle(resolve($value)); } - private function reject($reason) + private function reject(\Throwable $reason) { if (null !== $this->result) { return; @@ -198,7 +198,7 @@ private function call(callable $callback) function ($value = null) { $this->resolve($value); }, - function ($reason) { + function (\Throwable $reason) { $this->reject($reason); } ); diff --git a/src/RejectedPromise.php b/src/RejectedPromise.php index bfa85655..d256b98f 100644 --- a/src/RejectedPromise.php +++ b/src/RejectedPromise.php @@ -62,7 +62,7 @@ public function otherwise(callable $onRejected) public function always(callable $onFulfilledOrRejected) { - return $this->then(null, function ($reason) use ($onFulfilledOrRejected) { + return $this->then(null, function (\Throwable $reason) use ($onFulfilledOrRejected) { return resolve($onFulfilledOrRejected())->then(function () use ($reason) { return new RejectedPromise($reason); }); diff --git a/src/functions.php b/src/functions.php index c70b44c4..4f2dc54f 100644 --- a/src/functions.php +++ b/src/functions.php @@ -188,7 +188,7 @@ function some(array $promisesOrValues, $howMany) } }; - $rejecter = function ($reason) use ($i, &$reasons, &$toReject, $toResolve, $reject) { + $rejecter = function (\Throwable $reason) use ($i, &$reasons, &$toReject, $toResolve, $reject) { if ($toResolve < 1 || $toReject < 1) { return; }