← All changes
|
includes/sdk/s3/GuzzleHttp/Promise/PromiseInterface.php
+13
-20
1.2.9
→
1.4.1
View file →
| @@ -1,6 +1,7 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | +declare (strict_types=1); | |
| 3 | 4 | namespace Dudlewebs\WPMCS\s3\GuzzleHttp\Promise; |
| 4 | 5 | |
| 5 | 6 | /** |
| 6 | 7 | * A promise represents the eventual result of an asynchronous operation. |
| @@ -8,15 +9,15 @@ | ||
| 8 | 9 | * The primary way of interacting with a promise is through its then method, |
| 9 | 10 | * which registers callbacks to receive either a promise’s eventual value or |
| 10 | 11 | * the reason why the promise cannot be fulfilled. |
| 11 | 12 | * |
| 12 | - * @link https://promisesaplus.com/ | |
| 13 | + * @see https://promisesaplus.com/ | |
| 13 | 14 | */ |
| 14 | 15 | interface PromiseInterface |
| 15 | 16 | { |
| 16 | - const PENDING = 'pending'; | |
| 17 | - const FULFILLED = 'fulfilled'; | |
| 18 | - const REJECTED = 'rejected'; | |
| 17 | + public const PENDING = 'pending'; | |
| 18 | + public const FULFILLED = 'fulfilled'; | |
| 19 | + public const REJECTED = 'rejected'; | |
| 19 | 20 | /** |
| 20 | 21 | * Appends fulfillment and rejection handlers to the promise, and returns |
| 21 | 22 | * a new promise resolving to the return value of the called handler. |
| 22 | 23 | * |
| @@ -21,12 +22,10 @@ | ||
| 21 | 22 | * a new promise resolving to the return value of the called handler. |
| 22 | 23 | * |
| 23 | 24 | * @param callable $onFulfilled Invoked when the promise fulfills. |
| 24 | 25 | * @param callable $onRejected Invoked when the promise is rejected. |
| 25 | - * | |
| 26 | - * @return PromiseInterface | |
| 27 | 26 | */ |
| 28 | - public function then(callable $onFulfilled = null, callable $onRejected = null); | |
| 27 | + public function then(?callable $onFulfilled = null, ?callable $onRejected = null) : PromiseInterface; | |
| 29 | 28 | /** |
| 30 | 29 | * Appends a rejection handler callback to the promise, and returns a new |
| 31 | 30 | * promise resolving to the return value of the callback if it is called, |
| 32 | 31 | * or to its original fulfillment value if the promise is instead |
| @@ -32,21 +31,17 @@ | ||
| 32 | 31 | * or to its original fulfillment value if the promise is instead |
| 33 | 32 | * fulfilled. |
| 34 | 33 | * |
| 35 | 34 | * @param callable $onRejected Invoked when the promise is rejected. |
| 36 | - * | |
| 37 | - * @return PromiseInterface | |
| 38 | 35 | */ |
| 39 | - public function otherwise(callable $onRejected); | |
| 36 | + public function otherwise(callable $onRejected) : PromiseInterface; | |
| 40 | 37 | /** |
| 41 | 38 | * Get the state of the promise ("pending", "rejected", or "fulfilled"). |
| 42 | 39 | * |
| 43 | 40 | * The three states can be checked against the constants defined on |
| 44 | 41 | * PromiseInterface: PENDING, FULFILLED, and REJECTED. |
| 45 | - * | |
| 46 | - * @return string | |
| 47 | 42 | */ |
| 48 | - public function getState(); | |
| 43 | + public function getState() : string; | |
| 49 | 44 | /** |
| 50 | 45 | * Resolve the promise with the given value. |
| 51 | 46 | * |
| 52 | 47 | * @param mixed $value |
| @@ -52,9 +47,9 @@ | ||
| 52 | 47 | * @param mixed $value |
| 53 | 48 | * |
| 54 | 49 | * @throws \RuntimeException if the promise is already resolved. |
| 55 | 50 | */ |
| 56 | - public function resolve($value); | |
| 51 | + public function resolve($value) : void; | |
| 57 | 52 | /** |
| 58 | 53 | * Reject the promise with the given reason. |
| 59 | 54 | * |
| 60 | 55 | * @param mixed $reason |
| @@ -60,15 +55,15 @@ | ||
| 60 | 55 | * @param mixed $reason |
| 61 | 56 | * |
| 62 | 57 | * @throws \RuntimeException if the promise is already resolved. |
| 63 | 58 | */ |
| 64 | - public function reject($reason); | |
| 59 | + public function reject($reason) : void; | |
| 65 | 60 | /** |
| 66 | 61 | * Cancels the promise if possible. |
| 67 | 62 | * |
| 68 | - * @link https://github.com/promises-aplus/cancellation-spec/issues/7 | |
| 63 | + * @see https://github.com/promises-aplus/cancellation-spec/issues/7 | |
| 69 | 64 | */ |
| 70 | - public function cancel(); | |
| 65 | + public function cancel() : void; | |
| 71 | 66 | /** |
| 72 | 67 | * Waits until the promise completes if possible. |
| 73 | 68 | * |
| 74 | 69 | * Pass $unwrap as true to unwrap the result of the promise, either |
| @@ -75,13 +70,11 @@ | ||
| 75 | 70 | * returning the resolved value or throwing the rejected exception. |
| 76 | 71 | * |
| 77 | 72 | * If the promise cannot be waited on, then the promise will be rejected. |
| 78 | 73 | * |
| 79 | - * @param bool $unwrap | |
| 80 | - * | |
| 81 | 74 | * @return mixed |
| 82 | 75 | * |
| 83 | 76 | * @throws \LogicException if the promise has no wait function or if the |
| 84 | 77 | * promise does not settle after waiting. |
| 85 | 78 | */ |
| 86 | - public function wait($unwrap = \true); | |
| 79 | + public function wait(bool $unwrap = \true); | |
| 87 | 80 | } |