13
13
*
14
14
* If `$promiseOrValue` is a promise, it will be returned as is.
15
15
*
16
- * @param mixed $promiseOrValue
17
- * @return PromiseInterface
16
+ * @template T
17
+ * @param T $promiseOrValue
18
+ * @return PromiseInterface<T>
18
19
*/
19
20
function resolve ($ promiseOrValue = null )
20
21
{
@@ -72,8 +73,9 @@ function reject($promiseOrValue = null)
72
73
* will be an array containing the resolution values of each of the items in
73
74
* `$promisesOrValues`.
74
75
*
75
- * @param array $promisesOrValues
76
- * @return PromiseInterface
76
+ * @template T
77
+ * @param array<PromiseInterface<T>|T> $promisesOrValues
78
+ * @return PromiseInterface<array<T>>
77
79
*/
78
80
function all ($ promisesOrValues )
79
81
{
@@ -89,8 +91,9 @@ function all($promisesOrValues)
89
91
* The returned promise will become **infinitely pending** if `$promisesOrValues`
90
92
* contains 0 items.
91
93
*
92
- * @param array $promisesOrValues
93
- * @return PromiseInterface
94
+ * @template T
95
+ * @param array<PromiseInterface<T>|T> $promisesOrValues
96
+ * @return PromiseInterface<T>
94
97
*/
95
98
function race ($ promisesOrValues )
96
99
{
@@ -126,8 +129,9 @@ function race($promisesOrValues)
126
129
* The returned promise will also reject with a `React\Promise\Exception\LengthException`
127
130
* if `$promisesOrValues` contains 0 items.
128
131
*
129
- * @param array $promisesOrValues
130
- * @return PromiseInterface
132
+ * @template T
133
+ * @param array<PromiseInterface<T>|T> $promisesOrValues
134
+ * @return PromiseInterface<array<T>>
131
135
*/
132
136
function any ($ promisesOrValues )
133
137
{
@@ -151,9 +155,10 @@ function any($promisesOrValues)
151
155
* The returned promise will also reject with a `React\Promise\Exception\LengthException`
152
156
* if `$promisesOrValues` contains less items than `$howMany`.
153
157
*
154
- * @param array $promisesOrValues
158
+ * @template T
159
+ * @param array<PromiseInterface<T>|T> $promisesOrValues
155
160
* @param int $howMany
156
- * @return PromiseInterface
161
+ * @return PromiseInterface<array<T>>
157
162
*/
158
163
function some ($ promisesOrValues , $ howMany )
159
164
{
@@ -228,9 +233,10 @@ function some($promisesOrValues, $howMany)
228
233
* The map function receives each item as argument, where item is a fully resolved
229
234
* value of a promise or value in `$promisesOrValues`.
230
235
*
231
- * @param array $promisesOrValues
232
- * @param callable $mapFunc
233
- * @return PromiseInterface
236
+ * @template T
237
+ * @param array<PromiseInterface<T>|T> $promisesOrValues
238
+ * @param callable(T): T $mapFunc
239
+ * @return PromiseInterface<array<T>>
234
240
*/
235
241
function map ($ promisesOrValues , callable $ mapFunc )
236
242
{
@@ -276,10 +282,11 @@ function ($mapped) use ($i, &$values, &$toResolve, $resolve) {
276
282
* promise, *and* `$initialValue` may be a promise or a value for the starting
277
283
* value.
278
284
*
279
- * @param array $promisesOrValues
280
- * @param callable $reduceFunc
285
+ * @template T
286
+ * @param array<PromiseInterface<T>|T> $promisesOrValues
287
+ * @param callable(T): bool $reduceFunc
281
288
* @param mixed $initialValue
282
- * @return PromiseInterface
289
+ * @return PromiseInterface<array<T>>
283
290
*/
284
291
function reduce ($ promisesOrValues , callable $ reduceFunc , $ initialValue = null )
285
292
{
0 commit comments