Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Promise v3 template types #67

Merged
merged 1 commit into from
Jul 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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