-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[FrameworkBundle] Add check for installed yaml component #38394
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
Conversation
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 patch makes sense for the case where the developer relies on the default value.
But IMHO if one explicitly indicates yaml and it's not available, one should get an error suggesting to switch to xml or to install the yaml component.
This can be achieved by removing the default from the option definition and throwing when needed.
Should be done on master as this is a behavior change. |
3f8112c
to
4a3e393
Compare
src/Symfony/Bundle/FrameworkBundle/Command/ConfigDumpReferenceCommand.php
Outdated
Show resolved
Hide resolved
Have you checked if there are other commands that would need the same kind of change?
Thinking about it, I think changing the default value depending on the YAML component availability is not a good idea. I would instead keep the default and throw an exception when YAML is used (either explicitly or implicitly) and the component is not installed. |
Fair enough. But if we don't change the default, all this PR does is replacing an ugly exception with a nice error message. And that would be a valid thing to do in a bugfix release, wouldn't it? |
src/Symfony/Bundle/FrameworkBundle/Command/ConfigDumpReferenceCommand.php
Outdated
Show resolved
Hide resolved
src/Symfony/Bundle/FrameworkBundle/Command/ConfigDumpReferenceCommand.php
Outdated
Show resolved
Hide resolved
@@ -45,7 +46,7 @@ protected function configure() | |||
->setDefinition([ | |||
new InputArgument('name', InputArgument::OPTIONAL, 'The Bundle name or the extension alias'), | |||
new InputArgument('path', InputArgument::OPTIONAL, 'The configuration option path'), | |||
new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (yaml or xml)', 'yaml'), | |||
new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (yaml or xml)', class_exists(Yaml::class) ? 'yaml' : 'xml'), |
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.
should be reverted per the discussion
a12af43
to
f174ad2
Compare
Thank you @jschaedl. |
Todo: