[wp-trac] [WordPress Trac] #60786: [PHP 8.4] Fix implicit nullable parameter type depcation
WordPress Trac
noreply at wordpress.org
Sat Mar 16 03:35:34 UTC 2024
#60786: [PHP 8.4] Fix implicit nullable parameter type depcation
-----------------------------+--------------------------------
Reporter: ayeshrajans | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: trunk
Severity: normal | Resolution:
Keywords: php84 has-patch | Focuses: php-compatibility
-----------------------------+--------------------------------
Changes (by jrf):
* version: => trunk
Comment:
@ayeshrajans Thanks for the ping. I'm not working on an automated solution
(as the solution should be decided on a case-by-case basis), though I have
written a sniff to reliably find the issues already ;-)
I've had a look at your patch, but as the minimum PHP version is currently
still 7.0, the patch is not viable.
Aside from the `export.php` and the `media.php` file, the other files are
relatively new files, which should never have been allowed to be committed
with scalar type declarations as without enforcing strict types throughout
the eco-system (which we can't), that's next to useless and will hide
bugs, so in my opinion, removing the type declarations from the function
signatures in those files would be the correct solution direction.
As for `export.php` and `media.php`, as the involved functions are global
functions, there is no risk of the function being overloaded in a child
class, so removing the type and optionally, selectively casting to `array`
from within the function should allow for a workable solution.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/60786#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list