Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

PHP 8.4: Refactor implicitly nullable parameter types #386

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

W0rma
Copy link
Contributor

@W0rma W0rma commented May 17, 2024

Implicitly nullable parameter types are going to be deprecated in PHP 8.4 (https://wiki.php.net/rfc/deprecate-implicitly-nullable-types).

This PR makes them nullable explicitly.

Since nullable types were added in PHP 7.1 this PR drops support for PHP 7.0.

W0rma added 2 commits May 17, 2024 07:31
Implicitly nullable parameter types are going to be deprecated in PHP 8.4
@W0rma W0rma changed the title Refactor implicitly nullable parameter types PHP 8.4: Refactor implicitly nullable parameter types Nov 8, 2024
@W0rma
Copy link
Contributor Author

W0rma commented Nov 8, 2024

@metaregistrar Any thoughts about this?

The last RC for PHP 8.4 was released yesterday and GA is planned for Nov 21 2024 (see https://wiki.php.net/todo/php84).

It would be great to have a deprecation-free tagged version of the epp-client.

@metaregistrar
Copy link
Owner

I fully support having a php-84 compatible version, however your PR touches a lot of files, and i do have to verify not only if things keep on functioning but also if there is not too much that breaks on older php versions. I do not mind so much when eppExtensions files are changed (because you can enable and disable extensions). But this PR also touches some core files like eppResponse.php and eppException.php

@W0rma
Copy link
Contributor Author

W0rma commented Nov 13, 2024

@metaregistrar Yes, it is correct that this PR touches a lot of files.

However, the only change made by this PR is to add a question mark before parameters which have a native type hint and a default value of null. I just used the cs fixer rule nullable_type_declaration_for_default_null_value for that.

Logically it doesn't make any difference in PHP if you write function foo(Bar $bar = null) or function foo(?Bar $bar = null). The only difference is that with the first variant a deprecation warning is emitted in PHP 8.4.

This PR needs to bump the minimum PHP version from 7.0 to 7.1 because nullable types were added in PHP 7.1: https://www.php.net/manual/en/migration71.new-features.php#migration71.new-features.nullable-types

@W0rma
Copy link
Contributor Author

W0rma commented Dec 8, 2024

Logically it doesn't make any difference in PHP if you write function foo(Bar $bar = null) or function foo(?Bar $bar = null). The only difference is that with the first variant a deprecation warning is emitted in PHP 8.4.

@metaregistrar FYI https://3v4l.org/hKpEZ shows that it doesn't make any difference which of both styles is used in PHP.

Thus, the changes of this MR are completely uncritical.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants