Skip to content

Commit e49f949

Browse files
committed
Use \Throwable exclusively in rejection function docs
Follow-up for 505cf5e.
1 parent d3712e4 commit e49f949

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ $deferred = new React\Promise\Deferred();
9797
$promise = $deferred->promise();
9898

9999
$deferred->resolve(mixed $value = null);
100-
$deferred->reject(\Throwable|\Exception $reason);
100+
$deferred->reject(\Throwable $reason);
101101
```
102102

103103
The `promise` method returns the promise of the deferred.
@@ -132,7 +132,7 @@ this promise once it is resolved.
132132
#### Deferred::reject()
133133

134134
```php
135-
$deferred->reject(\Throwable|\Exception $reason);
135+
$deferred->reject(\Throwable $reason);
136136
```
137137

138138
Rejects the promise returned by `promise()`, signalling that the deferred's
@@ -234,7 +234,7 @@ $promise
234234
// Only catch \RuntimeException instances
235235
// All other types of errors will propagate automatically
236236
})
237-
->otherwise(function ($reason) {
237+
->otherwise(function (\Throwable $reason) {
238238
// Catch other errors
239239
)};
240240
```
@@ -270,7 +270,7 @@ Consider the following synchronous code:
270270
```php
271271
try {
272272
return doSomething();
273-
} catch(\Exception $e) {
273+
} catch (\Throwable $e) {
274274
return handleError($e);
275275
} finally {
276276
cleanup();
@@ -360,7 +360,7 @@ Creates a already rejected promise.
360360
$promise = React\Promise\RejectedPromise($reason);
361361
```
362362

363-
Note, that `$reason` **must** be a `\Throwable` or `\Exception`.
363+
Note, that `$reason` **must** be a `\Throwable`.
364364

365365
### Functions
366366

@@ -390,7 +390,7 @@ If `$promiseOrValue` is a promise, it will be returned as is.
390390
#### reject()
391391

392392
```php
393-
$promise = React\Promise\reject(\Throwable|\Exception $reason);
393+
$promise = React\Promise\reject(\Throwable $reason);
394394
```
395395

396396
Creates a rejected promise for the supplied `$reason`.
@@ -431,7 +431,7 @@ will be the resolution value of the triggering item.
431431
The returned promise will only reject if *all* items in `$promisesOrValues` are
432432
rejected. The rejection value will be a `React\Promise\Exception\CompositeException`
433433
which holds all rejection reasons. The rejection reasons can be obtained with
434-
`CompositeException::getExceptions()`.
434+
`CompositeException::getThrowables()`.
435435

436436
The returned promise will also reject with a `React\Promise\Exception\LengthException`
437437
if `$promisesOrValues` contains 0 items.
@@ -496,7 +496,7 @@ function getAwesomeResultPromise()
496496
$deferred = new React\Promise\Deferred();
497497

498498
// Execute a Node.js-style function using the callback pattern
499-
computeAwesomeResultAsynchronously(function (\Exception $error, $result) use ($deferred) {
499+
computeAwesomeResultAsynchronously(function (\Throwable $error, $result) use ($deferred) {
500500
if ($error) {
501501
$deferred->reject($error);
502502
} else {
@@ -513,7 +513,7 @@ getAwesomeResultPromise()
513513
function ($value) {
514514
// Deferred resolved, do something with $value
515515
},
516-
function (\Exception $reason) {
516+
function (\Throwable $reason) {
517517
// Deferred rejected, do something with $reason
518518
}
519519
);

0 commit comments

Comments
 (0)