Skip to content

Commit

Permalink
Merge pull request #67 from clue-labs/template-types
Browse files Browse the repository at this point in the history
Use Promise v3 template types
  • Loading branch information
SimonFrings committed Jul 20, 2023
2 parents a406555 + e396716 commit ac2da15
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ jobs:
steps:
- uses: actions/checkout@v3
- run: cp "$(which composer)" composer.phar && ./composer.phar self-update --2.2 # downgrade Composer for HHVM
- name: Run hhvm composer.phar install
- name: Run hhvm composer.phar require react/promise:^2 # downgrade Promise for HHVM
uses: docker://hhvm/hhvm:3.30-lts-latest
with:
args: hhvm composer.phar install
args: hhvm composer.phar require react/promise:^2
- name: Run hhvm vendor/bin/phpunit
uses: docker://hhvm/hhvm:3.30-lts-latest
with:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Timer\timeout(…);

### timeout()

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

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

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

```php
Expand Down
7 changes: 4 additions & 3 deletions src/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,11 @@
* For more details on the promise primitives, please refer to the
* [Promise documentation](https://github.com/reactphp/promise#functions).
*
* @param PromiseInterface<mixed> $promise
* @template T
* @param PromiseInterface<T> $promise
* @param float $time
* @param ?LoopInterface $loop
* @return PromiseInterface<mixed>
* @return PromiseInterface<T>
*/
function timeout(PromiseInterface $promise, $time, LoopInterface $loop = null)
{
Expand Down Expand Up @@ -318,7 +319,7 @@ function resolve($time, LoopInterface $loop = null)
*
* @param float $time
* @param LoopInterface $loop
* @return PromiseInterface<void>
* @return PromiseInterface<never>
* @deprecated 1.8.0 See `sleep()` instead
* @see sleep()
*/
Expand Down

0 comments on commit ac2da15

Please sign in to comment.