Skip to content

Commit d2aafad

Browse files
committed
Use Promise v3 template types
1 parent a406555 commit d2aafad

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Timer\timeout(…);
4747

4848
### timeout()
4949

50-
The `timeout(PromiseInterface<mixed> $promise, float $time, ?LoopInterface $loop = null): PromiseInterface<mixed>` function can be used to
50+
The `timeout(PromiseInterface<T> $promise, float $time, ?LoopInterface $loop = null): PromiseInterface<T>` function can be used to
5151
cancel operations that take *too long*.
5252

5353
You need to pass in an input `$promise` that represents a pending operation
@@ -239,7 +239,7 @@ $timer->cancel();
239239

240240
> Deprecated since v1.8.0, see [`sleep()`](#sleep) instead.
241241
242-
The `reject(float $time, ?LoopInterface $loop = null): PromiseInterface<void>` function can be used to
242+
The `reject(float $time, ?LoopInterface $loop = null): PromiseInterface<never>` function can be used to
243243
create a new promise which rejects in `$time` seconds with a `TimeoutException`.
244244

245245
```php

src/functions.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,11 @@
129129
* For more details on the promise primitives, please refer to the
130130
* [Promise documentation](https://github.com/reactphp/promise#functions).
131131
*
132-
* @param PromiseInterface<mixed> $promise
132+
* @template T
133+
* @param PromiseInterface<T> $promise
133134
* @param float $time
134135
* @param ?LoopInterface $loop
135-
* @return PromiseInterface<mixed>
136+
* @return PromiseInterface<T>
136137
*/
137138
function timeout(PromiseInterface $promise, $time, LoopInterface $loop = null)
138139
{
@@ -318,7 +319,7 @@ function resolve($time, LoopInterface $loop = null)
318319
*
319320
* @param float $time
320321
* @param LoopInterface $loop
321-
* @return PromiseInterface<void>
322+
* @return PromiseInterface<never>
322323
* @deprecated 1.8.0 See `sleep()` instead
323324
* @see sleep()
324325
*/

0 commit comments

Comments
 (0)