Skip to content

[Console] Allow setting aliases & hidden via command name passed to the constructor #60739

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

HypeMC
Copy link
Member

@HypeMC HypeMC commented Jun 7, 2025

Q A
Branch? 7.4
Bug fix? no
New feature? yes
Deprecations? no
Issues Fix #60394 (comment)
License MIT

Currently, setting an alias and/or marking a command as hidden via the name doesn't work when the name is passed as a constructor argument. For example:

$command = new MyCommand('name|alias');

This issue was noticed while working on #60394 as mentioned in the comment there: #60394 (comment).

@chalasr
Copy link
Member

chalasr commented Jun 7, 2025

I think not supporting it was done on purpose at the time as that special syntax was specifically introduced for #[AsCommand], and I believe it works as expected until 7.3. If I'm not mistaken this should only be fixed there

@HypeMC
Copy link
Member Author

HypeMC commented Jun 7, 2025

@chalasr If that's the case, then it currently works as expected on all versions. The problem in #60394 is that I started using this for cases that don't include the #[AsCommand] attribute. I'll retarget 7.4 as a feature.

Of course, this isn't the only possible approach, but I personally prefer this one since it doesn't require duplicating the alias handling logic in yet another place. That logic already exists in the Command and AddConsoleCommandPass classes.

@HypeMC HypeMC force-pushed the fix-setting-aliases-and-hidden-via-name branch from 270e21b to c37baa8 Compare June 7, 2025 15:54
@HypeMC HypeMC changed the base branch from 6.4 to 7.4 June 7, 2025 15:54
@HypeMC HypeMC added Feature and removed Bug labels Jun 7, 2025
@HypeMC HypeMC modified the milestones: 6.4, 7.4 Jun 7, 2025
@HypeMC HypeMC changed the title [Console] Fix setting aliases & hidden via name [Console] Enable setting aliases & hidden via name Jun 7, 2025
@HypeMC HypeMC force-pushed the fix-setting-aliases-and-hidden-via-name branch from c37baa8 to 03d612a Compare June 7, 2025 15:59
@HypeMC HypeMC changed the title [Console] Enable setting aliases & hidden via name [Console] Allow setting aliases & hidden via command name passed to the constructor Jun 7, 2025
@nicolas-grekas
Copy link
Member

Thank you @HypeMC.

@nicolas-grekas nicolas-grekas merged commit f24ffa0 into symfony:7.4 Jun 8, 2025
10 of 11 checks passed
@HypeMC HypeMC deleted the fix-setting-aliases-and-hidden-via-name branch June 8, 2025 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy