@@ -41,7 +41,7 @@ function sleep($time, LoopInterface $loop)
4141 * Block waiting for the given `$promise` to be fulfilled.
4242 *
4343 * ```php
44- * $result = Clue\React\Block\await($promise, $loop, $timeout );
44+ * $result = Clue\React\Block\await($promise, $loop);
4545 * ```
4646 *
4747 * This function will only return after the given `$promise` has settled, i.e.
@@ -69,16 +69,19 @@ function sleep($time, LoopInterface $loop)
6969 * See also the [examples](../examples/).
7070 *
7171 * If no `$timeout` argument is given and the promise stays pending, then this
72- * will potentially wait/block forever until the promise is settled.
72+ * will potentially wait/block forever until the promise is settled. To avoid
73+ * this, API authors creating promises are expected to provide means to
74+ * configure a timeout for the promise instead. For more details, see also the
75+ * [`timeout()` function](https://github.com/reactphp/promise-timer#timeout).
7376 *
74- * If a `$timeout` argument is given and the promise is still pending once the
77+ * If the deprecated `$timeout` argument is given and the promise is still pending once the
7578 * timeout triggers, this will `cancel()` the promise and throw a `TimeoutException`.
7679 * This implies that if you pass a really small (or negative) value, it will still
7780 * start a timer and will thus trigger at the earliest possible time in the future.
7881 *
7982 * @param PromiseInterface $promise
8083 * @param LoopInterface $loop
81- * @param null|float $timeout (optional) maximum timeout in seconds or null=wait forever
84+ * @param null|float $timeout [deprecated] (optional) maximum timeout in seconds or null=wait forever
8285 * @return mixed returns whatever the promise resolves to
8386 * @throws Exception when the promise is rejected
8487 * @throws TimeoutException if the $timeout is given and triggers
@@ -144,7 +147,7 @@ function ($error) use (&$exception, &$rejected, &$wait, $loop) {
144147 * $promise2
145148 * );
146149 *
147- * $firstResult = Clue\React\Block\awaitAny($promises, $loop, $timeout );
150+ * $firstResult = Clue\React\Block\awaitAny($promises, $loop);
148151 *
149152 * echo 'First result: ' . $firstResult;
150153 * ```
@@ -162,17 +165,20 @@ function ($error) use (&$exception, &$rejected, &$wait, $loop) {
162165 * Likewise, this will throw if an empty array of `$promises` is passed.
163166 *
164167 * If no `$timeout` argument is given and ALL promises stay pending, then this
165- * will potentially wait/block forever until the promise is fulfilled.
168+ * will potentially wait/block forever until the promise is fulfilled. To avoid
169+ * this, API authors creating promises are expected to provide means to
170+ * configure a timeout for the promise instead. For more details, see also the
171+ * [`timeout()` function](https://github.com/reactphp/promise-timer#timeout).
166172 *
167- * If a `$timeout` argument is given and ANY promises are still pending once
173+ * If the deprecated `$timeout` argument is given and ANY promises are still pending once
168174 * the timeout triggers, this will `cancel()` all pending promises and throw a
169175 * `TimeoutException`. This implies that if you pass a really small (or negative)
170176 * value, it will still start a timer and will thus trigger at the earliest
171177 * possible time in the future.
172178 *
173179 * @param array $promises
174180 * @param LoopInterface $loop
175- * @param null|float $timeout (optional) maximum timeout in seconds or null=wait forever
181+ * @param null|float $timeout [deprecated] (optional) maximum timeout in seconds or null=wait forever
176182 * @return mixed returns whatever the first promise resolves to
177183 * @throws Exception if ALL promises are rejected
178184 * @throws TimeoutException if the $timeout is given and triggers
@@ -224,7 +230,7 @@ function awaitAny(array $promises, LoopInterface $loop, $timeout = null)
224230 * $promise2
225231 * );
226232 *
227- * $allResults = Clue\React\Block\awaitAll($promises, $loop, $timeout );
233+ * $allResults = Clue\React\Block\awaitAll($promises, $loop);
228234 *
229235 * echo 'First promise resolved with: ' . $allResults[0];
230236 * ```
@@ -244,17 +250,20 @@ function awaitAny(array $promises, LoopInterface $loop, $timeout = null)
244250 * then this function will throw an `UnexpectedValueException` instead.
245251 *
246252 * If no `$timeout` argument is given and ANY promises stay pending, then this
247- * will potentially wait/block forever until the promise is fulfilled.
253+ * will potentially wait/block forever until the promise is fulfilled. To avoid
254+ * this, API authors creating promises are expected to provide means to
255+ * configure a timeout for the promise instead. For more details, see also the
256+ * [`timeout()` function](https://github.com/reactphp/promise-timer#timeout).
248257 *
249- * If a `$timeout` argument is given and ANY promises are still pending once
258+ * If the deprecated `$timeout` argument is given and ANY promises are still pending once
250259 * the timeout triggers, this will `cancel()` all pending promises and throw a
251260 * `TimeoutException`. This implies that if you pass a really small (or negative)
252261 * value, it will still start a timer and will thus trigger at the earliest
253262 * possible time in the future.
254263 *
255264 * @param array $promises
256265 * @param LoopInterface $loop
257- * @param null|float $timeout (optional) maximum timeout in seconds or null=wait forever
266+ * @param null|float $timeout [deprecated] (optional) maximum timeout in seconds or null=wait forever
258267 * @return array returns an array with whatever each promise resolves to
259268 * @throws Exception when ANY promise is rejected
260269 * @throws TimeoutException if the $timeout is given and triggers
0 commit comments