update to PHP-8.1
[m6w6/seekat] / lib / API / Future.php
1 <?php
2
3 namespace seekat\API;
4
5 interface Future {
6 /**
7 * @param callable $onCancel
8 * @return object Promisor providing a promise() method
9 */
10 function createContext(callable $onCancel = null) : object;
11
12 /**
13 * @return object promise
14 */
15 function getPromise(object $context) : object;
16
17 function isPromise(object $promise) : bool;
18
19 function cancelPromise(object $promise) : void;
20
21 /**
22 * @return object promise
23 */
24 function handlePromise(object $promise, callable $onResult = null, callable $onError = null) : object;
25
26 /**
27 * Create an immediately resolved promise
28 */
29 function resolve(mixed $value) : object;
30
31 /**
32 * @param object $context Promisor returned by createContext
33 */
34 function resolver(object $context) : \Closure;
35
36 /**
37 * Create an immediately rejected promise
38 */
39 function reject(mixed $reason) : object;
40
41 /**
42 * @param object $context Promisor returned by createContext
43 */
44 function rejecter(object $context) : \Closure;
45
46 /**
47 * @param array $promises
48 * @return object promise
49 */
50 function all(array $promises) : object;
51
52 /**
53 *
54 */
55 function reducer() : \Closure;
56 }