Exclude the wp-compat false positives from the PHPStan config - #145
Conversation
The johnbillion/wp-compat extension that comes with wp-cli-tests checks every WordPress symbol against the WordPress 4.9 baseline that wp-cli-tests configures. All six errors it reported are false positives of the same kind: WordPress 6.0 and 5.3 merely formalized the already documented `...$args` and `...$arg` parameters of `apply_filters()` and `do_action()` by adding them to the function signatures, so passing extra arguments to `the_generator`, `export_term_orphaned` and the other hooks has always worked. Co-authored-by: Pascal Birchler <pascal.birchler@gmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughPHPStan configuration adds targeted ChangesWordPress compatibility analysis
Estimated code review effort: 1 (Trivial) | ~3 minutes Merge Risk: ⚪ Minimal · up to This change only excludes two narrowly identified PHPStan false-positive diagnostics and does not alter runtime or product behavior. It is merge-ready after normal checks, with no actionable merge-blocking risk remaining. Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Full details: Docstring CoverageExplanation No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (1 skipped: 1 unsupported.) ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
The
johnbillion/wp-compatPHPStan extension that now ships withwp-cli-testschecks every WordPress symbol against the WordPress 4.9 baseline thatwp-cli-testsconfigures. It reported six errors here, and all six are the same false positive in two flavours.Parameter $args of apply_filters() is only available since WordPress version 6.0.0src/WP_Export_Query.php...$argsparameter by adding it to the function signature"Parameter $arg of do_action() is only available since WordPress version 5.3.0src/WP_Export_Returner.php,src/WP_Export_Split_Files_Writer.php,src/WP_Export_XML_Over_HTTP.phpdo_action()in WordPress 5.3In both cases the extra arguments were collected through
func_get_args()long before the signatures changed, so passing them tothe_generator,export_term_orphaned,wp_export_new_fileand friends has always worked.Ignored by error identifier and path. No message scoping was needed:
WPCompat.parameterNotAvailable.applyfilters.argsandWPCompat.parameterNotAvailable.doaction.argalready name one specific parameter of one specific function, so these entries cannot swallow an unrelated diagnostic.No source changes: nothing here is an actual compatibility problem.
Verification
Run locally against the same dependency versions CI resolves (
johnbillion/wp-compat2.0.0,php-stubs/wordpress-stubsv6.9.4,wp-cli/wp-cli-testsv5.2.3):composer phpstan—[OK] No errors, with no unmatched ignore entriesignore.unmatchederror, confirming the entries above match real errors rather than sitting there unusedGitHub Actions was failing to allocate runners across the org while this was written, so CI may need a re-run once that clears.
Generated by Claude Code
Summary by CodeRabbit