PHP 8.2: remove deprecated callable in Style Engine value functions #44561
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes: #44536
Props to @jrfnl for raising the issue and explaining the options.
What?
A sync of the 6.1 Core patch: WordPress/wordpress-develop#3363
Why?
The string syntax for callables will be deprecated in PHP version 9.
8.2 shows a deprecation notice.
See: https://wiki.php.net/rfc/deprecate_partially_supported_callables
See comment: https://core.trac.wordpress.org/ticket/56467#comment:242 for a description of the deprecation notice and explanation.
How?
This PR switches to use to array( self::class, '*' ) and makes the WP_Style_Engine class final with the understanding that we won't need to, nor should we, extend it.
Testing Instructions
Things should work as expected, PHP unit tests should pass.
As for the compat check, PHP Gutenberg doesn't run unit tests against 8.2 so for now, check the 8.2 unit tests logs as described over in WordPress/wordpress-develop#3363