Repository navigation
Fix PHPStan errors from get_flag_value() returning bool|null - #263
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NDYX767HJCpR3xuCfhBTDm
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (1)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughFour media command methods now pass ChangesBoolean Flag Defaults
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~8 minutes Change: Refactor Suggested reviewers: Merge Risk: ⚪ Minimal · up to The explicit defaults preserve behavior when flags are omitted while addressing the boolean type inference. No actionable merge-blocking risk remains. 🚥 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! |
PHPStan now infers a more precise return type for
Utils\get_flag_value()through the dynamic return type extension inwp-cli/wp-cli-tests. That type is the flag's type unioned with the default's type, so boolean flags read with no default came back asbool|null. Six call sites then failed to type-check, because the values are passed to methods that expectbool(failing run).This PR passes an explicit
falsedefault for the boolean flagsskip-delete,only-missing,delete-unknown,update-attachment-refs,remove-abandonedanddry-run. There is no behavior change: a missing flag used to benulland is nowfalse, and both are falsy everywhere they're used.Verified locally:
composer phpstanreports the same 6 errors onmainand none with this change.composer phpcsis clean.🤖 Generated with Claude Code
https://claude.ai/code/session_01NDYX767HJCpR3xuCfhBTDm
Generated by Claude Code
Summary by CodeRabbit