Skip to content

Commit 9be7c11

Browse files
committed
Terminology update ($error -> $reason)
1 parent 60a4379 commit 9be7c11

5 files changed

Lines changed: 15 additions & 15 deletions

File tree

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ $deferred = new React\Promise\Deferred();
8383

8484
$deferred->then(callable $fulfilledHandler = null, callable $errorHandler = null, callable $progressHandler = null);
8585
$deferred->resolve(mixed $promiseOrValue = null);
86-
$deferred->reject(mixed $error = null);
86+
$deferred->reject(mixed $reason = null);
8787
$deferred->progress(mixed $update = null);
8888
```
8989

@@ -152,12 +152,12 @@ Resolves a Deferred. All consumers are notified by having their
152152
`$result`.
153153

154154
``` php
155-
$resolver->reject(mixed $error = null);
155+
$resolver->reject(mixed $reason = null);
156156
```
157157

158158
Rejects a Deferred, signalling that the Deferred's computation failed.
159159
All consumers are notified by having their `$errorHandler` (which they
160-
registered via `$promise->then()`) called with `$error`.
160+
registered via `$promise->then()`) called with `$reason`.
161161

162162
``` php
163163
$resolver->progress(mixed $update = null);
@@ -290,8 +290,8 @@ getAwesomeResultPromise()
290290
function ($result) {
291291
// Deferred resolved, do something with $result
292292
},
293-
function ($error) {
294-
// Deferred rejected, do something with $error
293+
function ($reason) {
294+
// Deferred rejected, do something with $reason
295295
},
296296
function ($update) {
297297
// Progress notification triggered, do something with $update

src/React/Promise/Deferred.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ public function resolve($result = null)
8383
return $this->promise();
8484
}
8585

86-
public function reject($error = null)
86+
public function reject($reason = null)
8787
{
88-
return $this->resolve(new RejectedPromise($error));
88+
return $this->resolve(new RejectedPromise($reason));
8989
}
9090

9191
public function progress($update = null)

src/React/Promise/DeferredResolver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ public function resolve($result = null)
1616
return $this->deferred->resolve($result);
1717
}
1818

19-
public function reject($error = null)
19+
public function reject($reason = null)
2020
{
21-
return $this->deferred->reject($error);
21+
return $this->deferred->reject($reason);
2222
}
2323

2424
public function progress($update = null)

src/React/Promise/RejectedPromise.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@
44

55
class RejectedPromise implements PromiseInterface
66
{
7-
private $error;
7+
private $reason;
88

9-
public function __construct($error = null)
9+
public function __construct($reason = null)
1010
{
11-
$this->error = $error;
11+
$this->reason = $reason;
1212
}
1313

1414
public function then($fulfilledHandler = null, $errorHandler = null, $progressHandler = null)
1515
{
1616
try {
1717
if (!$errorHandler) {
18-
return new RejectedPromise($this->error);
18+
return new RejectedPromise($this->reason);
1919
}
2020

21-
return Util::promiseFor(call_user_func($errorHandler, $this->error));
21+
return Util::promiseFor(call_user_func($errorHandler, $this->reason));
2222
} catch (\Exception $exception) {
2323
return new RejectedPromise($exception);
2424
}

src/React/Promise/ResolverInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
interface ResolverInterface
66
{
77
public function resolve($result = null);
8-
public function reject($error = null);
8+
public function reject($reason = null);
99
public function progress($update = null);
1010
}

0 commit comments

Comments
 (0)