PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 27.7
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v27.7
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
wordpress-seo / vendor_prefixed / guzzlehttp / promises / src / PromiseInterface.php

PromiseInterface.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 27.7, at vendor_prefixed/guzzlehttp/promises/src/PromiseInterface.php

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