Fix PHPStan errors with WordPress 7.1 stubs - #650
Conversation
|
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 (6)
💤 Files with no reviewable changes (1)
Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review. 📝 WalkthroughWalkthroughThe changes refine PHPStan annotations, expand icon registry method suppressions, normalize post and site query results, request complete term objects, and update term generation and migration taxonomy handling. ChangesCommand data contracts
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to This PR corrects WordPress 7.1 type annotations and preserves the existing taxonomy validation and migration behavior. No actionable merge-blocking risk remains after normal checks and review. Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 85.71% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 4 files. (1 skipped: 1 unsupported.) ✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 Generate docstrings
🧪 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 |
php-stubs/wordpress-stubs v7.1.0 tightened the types of get_sites(), get_terms(), wp_insert_term(), wp_delete_term(), WP_Query::$posts and WP_Comment_Query::query(), and it now covers the Icons API.
5576bfa to
a678aae
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
php-stubs/wordpress-stubsv7.1.0 tightened the types of several WordPress core functions, which surfaced 23 new PHPStan errors.get_sites()andget_terms()gained conditional return types, soSite_Command::get_sites_iterator()andTerm_Command::list_()now pincount/fieldsto the query defaults they already relied on. Both keys are stripped from the query args before that anyway, so nothing changes at runtime.WP_Query::$postsis now nullable andWP_Comment_Query::query()returns non-negative ints, so the annotations inPost_CommandandComment_Commandwere corrected.wp_insert_term()wants a non-negativeparentandwp_delete_term()a non-empty$taxonomy;Term_Command::migrate()now validates withtaxonomy_exists()(equivalent to theget_taxonomy()check it replaces) and passes the taxonomy name straight through.@phpstan-ignore method.deprecatedcomments that no longer match, and the Icons APIclass.notFound/function.notFoundentries now that the stubs cover it. TheWPCompatentries for the version-gatedwp iconcommands were extended to the methods that only became visible with those stubs.Generated by Claude Code
Summary by CodeRabbit