Repository navigation
Conversation
…s via Reflection. PHP 8.6 deprecates passing an object to `ReflectionMethod::invoke()` and `ReflectionMethod::invokeArgs()` when the method is static. This updates the `call_method()` helper in the plugin dependencies tests to pass `null` for static methods, and calls the public static `WP_Theme_JSON::process_blocks_custom_css()` method directly instead of through Reflection. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the test-only PHP 8.6 deprecation changes.
No open issues 🎉
What changed in this PR
Updates PHPUnit tests to avoid PHP 8.6 deprecations caused by passing objects when invoking static methods through Reflection. Production code is unchanged.
Changes:
- Passes
nullfor static methods in the plugin-dependency test helper, while retaining the instance for non-static methods. - Replaces Reflection with a direct call to the public static
WP_Theme_JSON::process_blocks_custom_css()method.
| File | Description |
|---|---|
tests/phpunit/tests/theme/wpThemeJson.php |
Calls the public static method directly and removes unnecessary setup. |
tests/phpunit/tests/admin/plugin-dependencies/base.php |
Selects the appropriate object argument for reflected method calls. |
Review effort: Balanced
desrosj
marked this pull request as ready for review
November 3, 2026 17:44
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
desrosj
requested review from
a team,
aaronjorbin,
johnbillion,
swissspidy and
westonruter
November 3, 2026 17:45
westonruter
approved these changes
Nov 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
PHP 8.6 deprecates passing an object to
ReflectionMethod::invoke()andReflectionMethod::invokeArgs()when the target method is static (RFC, php/php-src#23223). This causes 15 errors in the PHP 8.6 PHPUnit jobs:Changes:
tests/phpunit/tests/admin/plugin-dependencies/base.php: thecall_method()helper now passesnullwhen the reflected method is static, and the instance otherwise.tests/phpunit/tests/theme/wpThemeJson.php:WP_Theme_JSON::process_blocks_custom_css()has beenpublic staticsince 7.0.0, so the test now calls it directly instead of through Reflection.I audited every
invoke()/invokeArgs()call insrc/andtests/, and these are the only two places that pass an object for a static method. Production code doesn't invoke methods through Reflection.Trac ticket: Core-66457.
Use of AI Tools
Claude Code (Claude Opus 5.5) analyzed the PHP 8.6 CI failures, audited the codebase for other instances and drafted the changes. I reviewed the changes.
🤖 Generated with Claude Code