diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 60d4f7a..ea0f7b8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -69,6 +69,9 @@ jobs: - name: Checkout code uses: actions/checkout@v3 + - name: Remove phpspec + run: composer remove --dev friends-of-phpspec/phpspec-code-coverage phpspec/phpspec + - name: PHPStan uses: OskarStark/phpstan-ga@0.12.32 env: diff --git a/CHANGELOG.md b/CHANGELOG.md index a10d4e9..cdbf39c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,14 @@ # Change Log -## 1.2.1 +## 1.2.2 - unreleased -### Added - 2023-11-08 +### Fixed + +- Changed `Promise` to use a template for the exception class that is allowed. + +## 1.2.1 - 2023-11-08 + +### Fixed - Fixed PHPDoc for `wait()` and `then()`'s `onRejected` callable diff --git a/src/Promise.php b/src/Promise.php index 81434ae..7935fbc 100644 --- a/src/Promise.php +++ b/src/Promise.php @@ -14,6 +14,8 @@ * @author Márk Sági-Kazár * * @template-covariant T + * + * @template E of \Throwable */ interface Promise { @@ -38,10 +40,10 @@ interface Promise * If you do not care about one of the cases, you can set the corresponding callable to null * The callback will be called when the value arrived and never more than once. * - * @param callable(T): V|null $onFulfilled called when a response will be available - * @param callable(\Throwable): V|null $onRejected called when an exception occurs + * @param callable(T): V|null $onFulfilled called when a response will be available + * @param callable(E): V|null $onRejected called when an exception occurs * - * @return Promise a new resolved promise with value of the executed callback (onFulfilled / onRejected) + * @return Promise a new resolved promise with value of the executed callback (onFulfilled / onRejected) * * @template V */ @@ -67,7 +69,7 @@ public function getState(); * * @return ($unwrap is true ? T : null) Resolved value, null if $unwrap is set to false * - * @throws \Exception the rejection reason if $unwrap is set to true and the request failed + * @throws E the rejection reason if $unwrap is set to true and the request failed */ public function wait($unwrap = true); }