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.
[Console] Expose the original input arguments and options and to unparse options #57598
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.3
Are you sure you want to change the base?
[Console] Expose the original input arguments and options and to unparse options #57598
Changes from all commits
a944a32
378f1c6
0a834b9
d36058e
9338ba8
b01d0ef
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
This function should be extracted to a dedicated class (SRP) so that it's easier to maintain: we can change it more easily. I don't know for the class name and namespace (we need to think about it). The method signature would be:
Note:
webmozarts/console-parallelization
has a class dedicated to serialization, and that's great.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.
I agree on principle, and more generally
Input
and its children are doing too much making them harder to maintain (although thankfully they don't change often, so that alleviates that).I am not sure it is best to move this now though, because:
::parse()
which is part ofInput
, hence you would put two very closely related pieces in different places::parse()
is abstract, hence every children implement its own. So in theory you could have different implementations of::unparse()
to specific to an input implementation.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.
According to how you would use this method in
webmozarts/console-parallelization
, you have a list of option names to exclude. This parameter should be$excludedOptions
?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.
In
WebmozartsConsoleParallelization
we know the options we do NOT want, hence to get the ones we need to forward we need to juggle with the command definition. It is a specific use case for that feature, but not the only one, for instance you could want those values for specific options.That's why I thought it would be better in Symfony to have a more re-usable piece of code (which is also simpler) even thought that means a tiny bit more work on my side.
Check failure on line 225 in src/Symfony/Component/Console/Input/Input.php
InvalidArgument
Check failure on line 225 in src/Symfony/Component/Console/Input/Input.php
InvalidArgument
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.
To avoid any BC break, we can add a new interface for these new capabilities:
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.
Would that really help? In the end what you receive, because that is what is typed everywhere, is
InputInterface
. Having a separate interface would bring back something similar to this code:Which... err yes in practice if we make
Input
implement it it will work 99% of the cases but type-wise leaves it to be desired.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.
Just to clarify: the only affected users are users implementing
InputInterface
without extendingInput
, which AFAIK (but I can be wrong) is extremely rare, unless you're aware of more cases/usages in the wild?