Skip to content

Make nullable parameter types explicit#175

Merged
dbu merged 1 commit into
php-http:2.xfrom
derrabus:bugfix/implicit-nullable
Mar 15, 2024
Merged

Make nullable parameter types explicit#175
dbu merged 1 commit into
php-http:2.xfrom
derrabus:bugfix/implicit-nullable

Conversation

@derrabus

Copy link
Copy Markdown
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

@dbu dbu left a comment

Copy link
Copy Markdown
Contributor

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.

}

public function then(callable $onFulfilled = null, callable $onRejected = null)
public function then(?callable $onFulfilled = null, ?callable $onRejected = null)

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
@dbu

dbu commented Mar 15, 2024

Copy link
Copy Markdown
Contributor

thanks a lot!

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

Copy link
Copy Markdown
Contributor Author

Thank you!

@eiriksm

eiriksm commented Sep 23, 2024

Copy link
Copy Markdown

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

dbu commented Sep 23, 2024

Copy link
Copy Markdown
Contributor

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