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

Conversation

Ndiritu
Copy link
Contributor

@Ndiritu Ndiritu commented Nov 7, 2023

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Related tickets fixes #29
Documentation if this is a new feature, link to pull request in https://github.com/php-http/documentation that adds relevant documentation
License MIT

What's in this PR?

  • Corrects the PHPDoc for wait() to handle the possible void and null return values based on the method's description.
  • Uses the \Throwable interface instead of \Exception in onRejected callable parameter type
  • Adds PHPStan configs and workflow checks to catch future issues early.

Checklist

  • Updated CHANGELOG.md to describe BC breaks / deprecations | new feature | bugfix

To Do

  • Should we consider using conditional return types for wait() e.g. @return ($unwrap is true ? T : null|void). This would eliminate further PHPStan failures for dependent libs, however this syntax requires PHPStan ^1.6.0. Would this be a better approach? At the moment, using T|null|void could cause further PHPStan failures for dependent libs. Would these further failures be considered a BC break?

@dbu
Copy link
Contributor

dbu commented Nov 7, 2023

1.6 is from april 2022, so i think that seems reasonable to expect.

lets add that and avoid further confusion for consumers phpstan checks.

src/Promise.php Outdated Show resolved Hide resolved
Copy link
Contributor

@dbu dbu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks a lot!

@dbu dbu merged commit 7fa2284 into php-http:1.x Nov 8, 2023
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PHPStan level 9 failure
2 participants