1313 *
1414 * If `$promiseOrValue` is a promise, it will be returned as is.
1515 *
16- * @param mixed $promiseOrValue
17- * @return PromiseInterface
16+ * @template T
17+ * @param T $promiseOrValue
18+ * @return PromiseInterface<T>
1819 */
1920function resolve ($ promiseOrValue = null )
2021{
@@ -72,8 +73,9 @@ function reject($promiseOrValue = null)
7273 * will be an array containing the resolution values of each of the items in
7374 * `$promisesOrValues`.
7475 *
75- * @param array $promisesOrValues
76- * @return PromiseInterface
76+ * @template T
77+ * @param array<PromiseInterface<T>|T> $promisesOrValues
78+ * @return PromiseInterface<array<T>>
7779 */
7880function all ($ promisesOrValues )
7981{
@@ -89,8 +91,9 @@ function all($promisesOrValues)
8991 * The returned promise will become **infinitely pending** if `$promisesOrValues`
9092 * contains 0 items.
9193 *
92- * @param array $promisesOrValues
93- * @return PromiseInterface
94+ * @template T
95+ * @param array<PromiseInterface<T>|T> $promisesOrValues
96+ * @return PromiseInterface<T>
9497 */
9598function race ($ promisesOrValues )
9699{
@@ -126,8 +129,9 @@ function race($promisesOrValues)
126129 * The returned promise will also reject with a `React\Promise\Exception\LengthException`
127130 * if `$promisesOrValues` contains 0 items.
128131 *
129- * @param array $promisesOrValues
130- * @return PromiseInterface
132+ * @template T
133+ * @param array<PromiseInterface<T>|T> $promisesOrValues
134+ * @return PromiseInterface<array<T>>
131135 */
132136function any ($ promisesOrValues )
133137{
@@ -151,9 +155,10 @@ function any($promisesOrValues)
151155 * The returned promise will also reject with a `React\Promise\Exception\LengthException`
152156 * if `$promisesOrValues` contains less items than `$howMany`.
153157 *
154- * @param array $promisesOrValues
158+ * @template T
159+ * @param array<PromiseInterface<T>|T> $promisesOrValues
155160 * @param int $howMany
156- * @return PromiseInterface
161+ * @return PromiseInterface<array<T>>
157162 */
158163function some ($ promisesOrValues , $ howMany )
159164{
@@ -228,9 +233,10 @@ function some($promisesOrValues, $howMany)
228233 * The map function receives each item as argument, where item is a fully resolved
229234 * value of a promise or value in `$promisesOrValues`.
230235 *
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>>
234240 */
235241function map ($ promisesOrValues , callable $ mapFunc )
236242{
@@ -276,10 +282,11 @@ function ($mapped) use ($i, &$values, &$toResolve, $resolve) {
276282 * promise, *and* `$initialValue` may be a promise or a value for the starting
277283 * value.
278284 *
279- * @param array $promisesOrValues
280- * @param callable $reduceFunc
285+ * @template T
286+ * @param array<PromiseInterface<T>|T> $promisesOrValues
287+ * @param callable(T): bool $reduceFunc
281288 * @param mixed $initialValue
282- * @return PromiseInterface
289+ * @return PromiseInterface<array<T>>
283290 */
284291function reduce ($ promisesOrValues , callable $ reduceFunc , $ initialValue = null )
285292{
0 commit comments