Repository navigation
Add declarative deprecation handling for commands and assoc args - #6343
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Co-authored-by: swissspidy <[email protected]>
Copilot
AI
changed the title
[WIP] Add a declarative way to mark commands and arguments deprecated
Add declarative deprecation handling for commands and assoc args
Jul 16, 2026
swissspidy
reviewed
Jul 16, 2026
This comment was marked as resolved.
This comment was marked as resolved.
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
swissspidy
reviewed
Jul 16, 2026
swissspidy
reviewed
Jul 16, 2026
This comment was marked as resolved.
This comment was marked as resolved.
…nt YAML block from Options Co-authored-by: swissspidy <[email protected]>
This comment was marked as resolved.
This comment was marked as resolved.
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
This comment was marked as resolved.
This comment was marked as resolved.
Co-authored-by: swissspidy <[email protected]>
This comment was marked as resolved.
This comment was marked as resolved.
schlessera
reviewed
Jul 20, 2026
schlessera
requested changes
Jul 20, 2026
There was a problem hiding this comment.
🧹 Nitpick comments (1)
php/WP_CLI/DocParser.php (1)
141-145: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winCover the explicit
deprecated: falsebranch with a regression test.Current tests cover non-empty and empty-string messages, but not the newly introduced behavior that explicitly disabled metadata is ignored. Add a fixture asserting
deprecated: falseis omitted from the returned map.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@php/WP_CLI/DocParser.php` around lines 141 - 145, Add a regression fixture for the deprecation parsing flow in DocParser, asserting that an argument with explicit deprecated: false is omitted from the returned map. Keep existing coverage for non-empty and empty-string deprecated messages unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@php/WP_CLI/DocParser.php`:
- Around line 141-145: Add a regression fixture for the deprecation parsing flow
in DocParser, asserting that an argument with explicit deprecated: false is
omitted from the returned map. Keep existing coverage for non-empty and
empty-string deprecated messages unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: d06dcab1-fa4d-4d3a-a960-e6cebe0805bd
📒 Files selected for processing (5)
features/command.featurephp/WP_CLI/Dispatcher/Subcommand.phpphp/WP_CLI/DocParser.phpphp/commands/src/Help_Command.phptests/DocParserTest.php
🚧 Files skipped from review as they are similar to previous changes (4)
- php/commands/src/Help_Command.php
- tests/DocParserTest.php
- php/WP_CLI/Dispatcher/Subcommand.php
- features/command.feature
Covers the branch in `DocParser::get_deprecated_assoc_args()` where an explicit `deprecated: false` marks an argument as not deprecated, so it is omitted from the returned map. Complements existing coverage for the non-empty and empty-string deprecation messages. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
schlessera
approved these changes
Jul 21, 2026
This was referenced Jul 21, 2026
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.
This introduces framework-level deprecation handling based on command docblocks and argument YAML metadata, so command authors no longer need to manually emit warnings. Deprecated commands/args are now surfaced consistently in both help output and runtime execution paths.
Command-level deprecation from PHPDoc
DocParser::get_deprecation_message()to parse@deprecated ....Subcommand::invoke()now emits a warning before execution when the command is marked deprecated.Argument-level deprecation from synopsis YAML
Subcommandfrom option metadata:deprecated: <message>Help output integration
Help_Commandnow appends a deprecation sentence inSYNOPSISfor deprecated commands.Coverage updates
@deprecatedparsing inDocParserTest.features/command.feature.With this, help includes deprecation guidance and runtime prints warnings before invoking deprecated command paths.
Summary by CodeRabbit