-
Notifications
You must be signed in to change notification settings - Fork 25
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] Fixes for implicit nullability deprecation #16
Conversation
Fixes all issues that emits a deprecation notice on PHP 8.4. See: - [RFC](https://wiki.php.net/rfc/deprecate-implicitly-nullable-types) - [PHP 8.4: Implicitly nullable parameter declarations deprecated](https://php.watch/versions/8.4/implicitly-marking-parameter-type-nullable-deprecated)
?string $clientFilename = null, | ||
?string $clientMediaType = 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.
Note: This syntax is supported as of PHP 7.1.0, and predates generalized union types support.
As this package supports PHP 7.0, we cannot use nullable types without other changes.
Additionally, such changes MUST be targeted to the PHP-FIG specification before being targeted to the implementation. cc @mbniebergall @Jean85 @weierophinney
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 for the quick review. You are right, we can't make these changes without bumping the minimum PHP version to 7.1+.
As far as specification goes, I think this is merely an implementation detail. Both string $clientFilename = null
and ?string $clientFilename = null
are effectively identical for LSP and Reflection APIs, so changing this should have no impact on PSR implementations.
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.
@shadowhand int $paramName = null
is semantically equivalent to ?int $paramName
, and it's been that way since parameter type hints were introduced; PHP just didn't formalize the concept of nullable types until 7.1.
I think at this point, it's fine to bump to 7.1. When you look at Packagist stats, across all packages, 7.0 only has a 1.3% usage... and when you look at the http-factory stats... it has 0% usage. I think we can safely bump.
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.
Per my note, I think it's safe to do this, but we also need to bump the minimum supported PHP version to 7.1 as part of this request, and it should target a new minor.
I also don't think we need to change the spec, as the change doesn't introduce any change in behavior, nor, when we target 7.1, does it change the signature in any way that is backwards incompatible.
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.
I agree with @MWOP considerations, and our evolution bylaw does exactly these considerations and requirements. The same bylaw, though, requires the equivalent of an errata vote (and a spec+meta adaptation) to approve this new minor version; I suggest that we proceed with that, even if we can expect an easy, unanimous approval.
@Ayesh let's change the branch-alias in composer.json and bump to PHP >= 7.1 |
We need to follow the PSR evolution bylaw, which means:
|
Superseded by #17 |
Fixes all issues that emits a deprecation notice on PHP 8.4.
See: