-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Console] Add a way to check if an argument/option was provided #21210
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
[Console] Add a way to check if an argument/option was provided #21210
Conversation
Personally, I don't know why |
This solves part of the problem, but the always confusing What if we deprecate those methods in 3.3 and add instead two pair of new methods: |
@javiereguiluz: Ideally, that's what I want to do. But we can only deprecate the method easily, not adding the two new ones to the However, I agree that deprecating |
Great 👍 For the naming, my preference would go for
(in this order). 👍 For deprecating |
Just for the record: I don't like |
Can you explain usage of this feature? To me, that's never needed. You shouldn't care about whether the user passed an argument or an option, you should only care about the value of such arguments and options. And the value is defined either by the default value configured in the command if not passed, or by the end user directly. But, and that's the important part, this shouldn't make a difference. |
#20044 this is a bug on Console that should be fixed, when passing |
@fabpot: I saw a use-case when working on the bin/console list --show-hidden # show hidden commands
bin/console list --show-hidden=true # show hidden commands
bin/console list --show-hidden=false # hide hidden commands
bin/console list # auto: show/hide hidden commands according to the format Thus, the behavior is different according to the fact the option was passed or not... but re-thinking about it, that's probably bad semantics. I understand your point.
As there is no way to retrieve the Let's close this. :) |
#17597 was closed by making the docblock clearer, but the feature is still interesting IMHO.
I think it's fine without interface, and I don't have a good name for a new one anyway.
Regarding the methods naming, I hesitated between:
is(Argument/Option)Provided
is(Argument/Option)Given