Skip to content

Commit 1b513de

Browse files
committed
Merge pull request #8 from php-http/clarify-wait
clarify wait
2 parents 1bb7900 + bf8ddae commit 1b513de

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/Promise.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ interface Promise
3939
* The callback will be called when the value arrived and never more than once.
4040
*
4141
* @param callable $onFulfilled Called when a response will be available.
42-
* @param callable $onRejected Called when an error happens.
42+
* @param callable $onRejected Called when an exception occurs.
4343
*
4444
* @return Promise A new resolved promise with value of the executed callback (onFulfilled / onRejected).
4545
*/
@@ -55,15 +55,17 @@ public function getState();
5555
/**
5656
* Wait for the promise to be fulfilled or rejected.
5757
*
58-
* When this method returns, the request has been resolved and the appropriate callable has terminated.
58+
* When this method returns, the request has been resolved and if callables have been
59+
* specified, the appropriate one has terminated.
5960
*
60-
* When called with the unwrap option, the value is resolved, but not returned.
61+
* When $unwrap is true (the default), the response is returned, or the exception thrown
62+
* on failure. Otherwise, nothing is returned or thrown.
6163
*
6264
* @param bool $unwrap Whether to return resolved value / throw reason or not
6365
*
6466
* @return ResponseInterface|null Resolved value, null if $unwrap is set to false
6567
*
66-
* @throws \Exception The rejection reason.
68+
* @throws \Exception The rejection reason if $unwrap is set to true and the request failed.
6769
*/
6870
public function wait($unwrap = true);
6971
}

0 commit comments

Comments
 (0)