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

Accept Throwable for onRejected and expand return type for wait() #30

Merged
merged 6 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from 4 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
15 changes: 15 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,18 @@ jobs:
run: |
wget https://scrutinizer-ci.com/ocular.phar
php ocular.phar code-coverage:upload --format=php-clover build/coverage.xml

phpstan:
name: PHPStan
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: PHPStan
uses: OskarStark/[email protected]
env:
REQUIRE_DEV: false
with:
args: analyze --no-progress
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## 1.2.1

### Added

- Fixed PHPDoc for `wait()` and `then()`'s `onRejected` callable

## 1.2.0 - 2023-10-24

### Added
Expand Down
6 changes: 6 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
parameters:
level: max
checkMissingIterableValueType: false
treatPhpDocTypesAsCertain: false
paths:
- src
4 changes: 2 additions & 2 deletions src/Promise.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ interface Promise
* 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(\Exception): V|null $onRejected called when an exception occurs
* @param callable(\Throwable): V|null $onRejected called when an exception occurs
*
* @return Promise<V> a new resolved promise with value of the executed callback (onFulfilled / onRejected)
*
Expand All @@ -65,7 +65,7 @@ public function getState();
*
* @param bool $unwrap Whether to return resolved value / throw reason or not
*
* @return T Resolved value, null if $unwrap is set to false
* @return ($unwrap is true ? T : null|void) Resolved value, null if $unwrap is set to false
Ndiritu marked this conversation as resolved.
Show resolved Hide resolved
*
* @throws \Exception the rejection reason if $unwrap is set to true and the request failed
*/
Expand Down
Loading