Skip to content

Commit

Permalink
Use ternary for call to onRejected() in done()
Browse files Browse the repository at this point in the history
  • Loading branch information
trowski committed Jul 18, 2015
1 parent d0218c4 commit c71445c
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/Promise/Promise.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,13 +212,9 @@ public function done(callable $onFulfilled = null, callable $onRejected = null)
$this->onFulfilled($onFulfilled);
}

if (null !== $onRejected) {
$this->onRejected($onRejected);
} else {
$this->onRejected(function (Exception $exception) {
throw $exception; // Rethrow exception in uncatchable way.
});
}
$this->onRejected($onRejected ?: function (Exception $exception) {
throw $exception; // Rethrow exception in uncatchable way.
});
}

/**
Expand Down

0 comments on commit c71445c

Please sign in to comment.