PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 18.9
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v18.9
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 18.9, at vendor_prefixed/guzzlehttp/promises/src/PromiseInterface.php

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