Warn when commands override global arguments#6174
Merged
swissspidy merged 16 commits intomainfrom Mar 4, 2026
Merged
Conversation
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
… generic type Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add warning for overriding global arguments in commands
Warn when commands override global arguments
Dec 20, 2025
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
Check for global argument conflicts in CommandFactory::create_subcommand() to catch conflicts in class-based commands that bypass WP_CLI::add_command() Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Allows commands to opt-out of global argument conflict warnings by adding @skipglobalargcheck to their PHPdoc. This is useful for built-in commands that intentionally override global arguments. Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
- Remove 'This can lead to unexpected behavior' from warning to match test expectations - Use regex pattern matching for @skipglobalargcheck to prevent false positives - Ensures annotation is only detected as an actual PHPDoc tag, not in description text Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
1 task
swissspidy
reviewed
Feb 7, 2026
- Load dispatcher.php as part of LoadUtilityFunctions step - Remove separate LoadDispatcher bootstrap step - Add dispatcher.php to test bootstrap - Resolves "Call to undefined function WP_CLI\Dispatcher\get_path()" error in unit tests Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This comment was marked as resolved.
This comment was marked as resolved.
- Remove 2>&1 redirection from Behat tests - Add public get_docparser() method to CompositeCommand - Add public has_tag() method to DocParser for checking valueless tags - Refactor command_skips_global_arg_check() to use public APIs - Rename Subcommand's get_docparser() to create_mock_docparser() to avoid conflict - Fixes PHP 8.1+ compatibility issue with reflection - Improves code maintainability by using proper public APIs Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
This comment was marked as resolved.
This comment was marked as resolved.
bonny
added a commit
to bonny/WordPress-Simple-History
that referenced
this pull request
Mar 10, 2026
Avoids conflict with WP-CLI's global --user argument, which causes warnings on newer WP-CLI versions (wp-cli/wp-cli#6174). Adds functional test for --userid and --exclude_userid filters. Closes #629
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.