-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Console] Support BackedEnum
in invokable commands
#60586
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
base: 7.4
Are you sure you want to change the base?
Conversation
@@ -27,6 +28,7 @@ class Argument | |||
private array|\Closure $suggestedValues; | |||
private ?int $mode = null; | |||
private string $function = ''; | |||
private string $typeName = ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Option
attribute already has this same property.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sweet :)
src/Symfony/Component/Console/Exception/InvalidOptionException.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Console/Exception/InvalidOptionException.php
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the for the review, the code looks better like this.
src/Symfony/Component/Console/Exception/InvalidArgumentException.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Console/Exception/InvalidArgumentException.php
Outdated
Show resolved
Hide resolved
Co-authored-by: Nicolas Grekas <nicolas.grekas@gmail.com>
BackedEnum::from($value)
BackedEnum::cases()
to provide autocompletion. Also part of the error message.Example
Given this 2 backed enums
We declare this command:
Usage:

Error with invalid argument value:

Error with invalid option value:
