Skip to content

Commit

Permalink
Add missing Throwable parameter type-declarations to rejection functions
Browse files Browse the repository at this point in the history
  • Loading branch information
jsor committed May 9, 2019
1 parent f12d524 commit 8967d23
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Deferred.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
4 changes: 2 additions & 2 deletions src/Promise.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -198,7 +198,7 @@ private function call(callable $callback)
function ($value = null) {
$this->resolve($value);
},
function ($reason) {
function (\Throwable $reason) {
$this->reject($reason);
}
);
Expand Down
2 changes: 1 addition & 1 deletion src/RejectedPromise.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand Down
2 changes: 1 addition & 1 deletion src/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 8967d23

Please sign in to comment.