-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make Promise use template for exception
in httplug, we have documentation text that formulates that only specific exceptions may be used for the callback. the change in 1.2.0 to allow any Throwable was incorrect.
- Loading branch information
Showing
5 changed files
with
25 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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/[email protected] | ||
env: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,8 @@ | |
* @author Márk Sági-Kazár <[email protected]> | ||
* | ||
* @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<V> a new resolved promise with value of the executed callback (onFulfilled / onRejected) | ||
* @return Promise<V, E> 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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters