Fix PHPStan errors with WordPress 7.1 stubs - #544
Conversation
`WP_Theme::get()` is now typed as returning `string|false`, so guard the header values before passing them to `html_entity_decode()`/`wordwrap()`.
|
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 theme upgrader now skips update messages when the theme name is unavailable. Theme parsing now handles missing descriptions without calling ChangesTheme metadata handling
Estimated code review effort: 2 (Simple) | ~5 minutes Merge Risk: ⚪ Minimal · up to The change safely handles missing theme metadata before existing string operations without changing intended behavior, and no actionable merge-blocking risk remains. Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 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 |
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 WP core types.WP_Theme::get()now resolves tostring|falsefor the known headers, which surfaced three new PHPStan errors where those values were passed straight into string parameters.ExtensionUpgraderSkin::before(): guard the theme name beforehtml_entity_decode(), mirroring the existingisset()check on the plugin branch.ParseThemeNameInput::get_all_themes(): guard the theme description beforewordwrap(), falling back to an empty string.PHPStan is clean again; no behaviour change (
wordwrap( false )already produced an empty string).Generated by Claude Code
Summary by CodeRabbit