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

Make nullable parameter types explicit #175

Merged
merged 1 commit into from
Mar 15, 2024

Conversation

derrabus
Copy link
Contributor

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

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. 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)
Copy link
Contributor

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

Copy link
Contributor Author

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.

@derrabus
Copy link
Contributor Author

we don't need to consider this a BC break.

It's not, even if people extended the classes. This change doesn't break anything.

@dbu dbu merged commit 8777928 into php-http:2.x Mar 15, 2024
15 checks passed
@dbu
Copy link
Contributor

dbu commented Mar 15, 2024

thanks a lot!

@derrabus derrabus deleted the bugfix/implicit-nullable branch March 15, 2024 19:04
@derrabus
Copy link
Contributor Author

Thank you!

@eiriksm
Copy link

eiriksm commented Sep 23, 2024

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!

@GrahamCampbell GrahamCampbell mentioned this pull request Sep 23, 2024
3 tasks
@dbu
Copy link
Contributor

dbu commented Sep 23, 2024

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

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.

3 participants