-
Notifications
You must be signed in to change notification settings - Fork 39
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
Make nullable parameter types explicit #175
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks. i don't expect these classes to be extended, and the constructors certainly are no issue. so we don't need to consider this a BC break.
@@ -18,7 +18,7 @@ public function __construct(ResponseInterface $response) | |||
$this->response = $response; | |||
} | |||
|
|||
public function then(callable $onFulfilled = null, callable $onRejected = null) | |||
public function then(?callable $onFulfilled = null, ?callable $onRejected = null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we do this without the interface changing? if not, this bumps the minimum requirement of promise to the version that will contains php-http/promise#34
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we do this without the interface changing?
Yes, this is a purely syntactical change.
It's not, even if people extended the classes. This change doesn't break anything. |
thanks a lot! |
Thank you! |
Thanks a lot for the work here. Would it be possible to cut a new release with this fix included? 🤓 Thanks again for your work on this package! |
sure: https://github.com/php-http/httplug/releases/tag/2.4.1 there are currently merge requests on other php-http repositories to do the same cleanup |
What's in this PR?
This PR turns implicit nullable parameter types to explicit ones.
Why?
PHP allows to implicitly declare a nullable parameter type by setting the parameter's default value to
null
. However, in PHP 8.4 this syntax has been deprecated.https://wiki.php.net/rfc/deprecate-implicitly-nullable-types
see also php-http/promise#34