diff options
Diffstat (limited to 'vendor/guzzlehttp/promises/src/PromiseInterface.php')
-rw-r--r-- | vendor/guzzlehttp/promises/src/PromiseInterface.php | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/vendor/guzzlehttp/promises/src/PromiseInterface.php b/vendor/guzzlehttp/promises/src/PromiseInterface.php index e598331..2824802 100644 --- a/vendor/guzzlehttp/promises/src/PromiseInterface.php +++ b/vendor/guzzlehttp/promises/src/PromiseInterface.php @@ -1,5 +1,7 @@ <?php +declare(strict_types=1); + namespace GuzzleHttp\Promise; /** @@ -9,13 +11,13 @@ namespace GuzzleHttp\Promise; * which registers callbacks to receive either a promise’s eventual value or * the reason why the promise cannot be fulfilled. * - * @link https://promisesaplus.com/ + * @see https://promisesaplus.com/ */ interface PromiseInterface { - const PENDING = 'pending'; - const FULFILLED = 'fulfilled'; - const REJECTED = 'rejected'; + public const PENDING = 'pending'; + public const FULFILLED = 'fulfilled'; + public const REJECTED = 'rejected'; /** * Appends fulfillment and rejection handlers to the promise, and returns @@ -23,13 +25,11 @@ interface PromiseInterface * * @param callable $onFulfilled Invoked when the promise fulfills. * @param callable $onRejected Invoked when the promise is rejected. - * - * @return PromiseInterface */ public function then( callable $onFulfilled = null, callable $onRejected = null - ); + ): PromiseInterface; /** * Appends a rejection handler callback to the promise, and returns a new @@ -38,20 +38,16 @@ interface PromiseInterface * fulfilled. * * @param callable $onRejected Invoked when the promise is rejected. - * - * @return PromiseInterface */ - public function otherwise(callable $onRejected); + public function otherwise(callable $onRejected): PromiseInterface; /** * Get the state of the promise ("pending", "rejected", or "fulfilled"). * * The three states can be checked against the constants defined on * PromiseInterface: PENDING, FULFILLED, and REJECTED. - * - * @return string */ - public function getState(); + public function getState(): string; /** * Resolve the promise with the given value. @@ -60,7 +56,7 @@ interface PromiseInterface * * @throws \RuntimeException if the promise is already resolved. */ - public function resolve($value); + public function resolve($value): void; /** * Reject the promise with the given reason. @@ -69,14 +65,14 @@ interface PromiseInterface * * @throws \RuntimeException if the promise is already resolved. */ - public function reject($reason); + public function reject($reason): void; /** * Cancels the promise if possible. * - * @link https://github.com/promises-aplus/cancellation-spec/issues/7 + * @see https://github.com/promises-aplus/cancellation-spec/issues/7 */ - public function cancel(); + public function cancel(): void; /** * Waits until the promise completes if possible. @@ -86,12 +82,10 @@ interface PromiseInterface * * If the promise cannot be waited on, then the promise will be rejected. * - * @param bool $unwrap - * * @return mixed * * @throws \LogicException if the promise has no wait function or if the * promise does not settle after waiting. */ - public function wait($unwrap = true); + public function wait(bool $unwrap = true); } |