Fix PHPStan errors with WordPress 7.1 stubs - #29
Conversation
The WordPress 7.1 stubs now declare the AI and connector functions, so the `@phpstan-ignore` comments are obsolete and the prompt builder can be typed as `WP_AI_Client_Prompt_Builder`.
|
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)
💤 Files with no reviewable changes (1)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe change removes PHPStan suppression comments from AI and connector command methods. It updates AI prompt builder docblock types, removes prompt builder error checks, and keeps connector command runtime logic unchanged. ChangesCommand static analysis cleanup
Estimated code review effort: 1 (Trivial) | ~5 minutes Merge Risk: ⚪ Minimal · up to This change updates PHPStan annotations and removes unreachable error checks to match WordPress 7.1 declarations without changing deployment behavior or external contracts. No actionable merge-blocking risk remains beyond normal checks and review. 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, which made PHPStan fail onmain.wp_supports_ai(),wp_ai_client_prompt(),wp_get_connector(),wp_get_connectors()and theWordPress\AiClientDTOs are now declared, so the@phpstan-ignore function.notFound/class.notFoundcomments no longer match anything and are removed.wp_ai_client_prompt()declares a nativeWP_AI_Client_Prompt_Builderreturn type and never returns aWP_Error(only the generating methods do), so the unreachableis_wp_error( $builder )guards are dropped.\WordPress\AI_Client\Builders\Prompt_Builder, a class that does not exist; they now use\WP_AI_Client_Prompt_Builder, which also removes themixedreturn types on the image input helpers.No baseline entries or new ignores.
composer phpstanandcomposer phpcspass locally.Generated by Claude Code
Summary by CodeRabbit