Add WP-Compat PHPStan extension configuration - #360
Conversation
Adds the wp-compat PHPStan extension, which reports usage of WordPress functions, classes, methods and constants that are not available in the oldest supported WordPress version. `requiresAtLeast` is set to 4.9 in `extension.neon` so that all packages using this testing framework inherit the check. `pluginFile` is set to its default of `null` because wp-compat otherwise tries to determine the minimum version from a plugin or theme header. The parameters schema is declared here as well, mirroring what is already done for phpstan-strict-rules, so that the configuration remains valid when the extension is not loaded through phpstan/extension-installer. Co-authored-by: Pascal Birchler <pascal.birchler@gmail.com> Claude-Session: https://claude.ai/code/session_01NADf5amDBgJ4ZBbd2qgijy
|
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 (2)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe project adds ChangesWP Compat integration
Merge Risk: ⚪ Minimal · up to This PR adds WordPress compatibility checks through a dependency and configuration update without any actionable merge-blocking risk remaining after normal checks and review. 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. (2 skipped: 2 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! |
This PR integrates the WP-Compat PHPStan extension to enable WordPress compatibility checking in the codebase.
Summary
Added configuration and schema definitions for the WP-Compat PHPStan extension to validate code compatibility with WordPress versions.
Key Changes
johnbillion/wp-compatdependency to composer.jsonpluginFileto null (default behavior)requiresAtLeastto '4.9' (oldest supported WordPress version for WP-CLI)Implementation Details
The schema definition allows both
pluginFileandrequiresAtLeastto be nullable strings, providing flexibility in configuration while maintaining type safety through PHPStan's schema validation.https://claude.ai/code/session_01NADf5amDBgJ4ZBbd2qgijy
Summary by CodeRabbit