Fix newly reported PHPStan errors - #634
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
This PR addresses newly reported PHPStan type errors by adding local PHPDoc @var annotations in WP-CLI command implementations to help static analysis understand variable shapes during runtime-validated flows.
Changes:
- Added an inline
@varannotation for$meta_valueinCommandWithMeta::add()before passing the value intoWP_CLI::read_value(). - Added an inline
@varannotation for$categoriesinFont_Collection_Command::list_categories()before passing data to theFormatter.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/WP_CLI/CommandWithMeta.php | Adds a local PHPDoc type hint to clarify the expected $meta_value type for PHPStan. |
| src/Font_Collection_Command.php | Adds a local PHPDoc type hint for $categories to satisfy PHPStan before formatting output. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| list( $object_id, $meta_key ) = $args; | ||
|
|
||
| $meta_value = WP_CLI::get_value_from_arg_or_stdin( $args, 2 ); | ||
| /** @var array<mixed>|string $meta_value */ |
|
|
||
| $fields = [ 'slug', 'name' ]; | ||
| $formatter = new Formatter( $assoc_args, $fields, 'category' ); | ||
| /** @var array<int, array<string, mixed>> $categories */ |
|
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 skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThe pull request adds PHPDoc annotations for category data and metadata values in two PHP command implementations. Runtime behavior remains unchanged. ChangesType Documentation
Estimated code review effort: 1 (Trivial) | ~2 minutes 🚥 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 |
Summary by CodeRabbit