Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[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

Merged
merged 1 commit into from
Oct 6, 2020

Conversation

jschaedl
Copy link
Contributor

@jschaedl jschaedl commented Oct 3, 2020

Q A
Branch? master
Bug fix? yes
New feature? no
Deprecations? no
Tickets Fix #38301
License MIT
Doc PR -

Todo:

  • add tests

Copy link
Member

@chalasr chalasr left a 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.

@jschaedl jschaedl changed the base branch from master to 3.4 October 4, 2020 07:10
@fabpot
Copy link
Member

fabpot commented Oct 4, 2020

Should be done on master as this is a behavior change.

@jschaedl jschaedl changed the base branch from 3.4 to master October 4, 2020 09:42
@jschaedl jschaedl force-pushed the issue-38301 branch 2 times, most recently from 3f8112c to 4a3e393 Compare October 4, 2020 09:53
fabpot
fabpot previously approved these changes Oct 5, 2020
@fabpot fabpot dismissed their stale review October 5, 2020 06:25

Have you checked if there are other commands that would need the same kind of change?

@fabpot
Copy link
Member

fabpot commented Oct 5, 2020

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.

@derrabus
Copy link
Member

derrabus commented Oct 5, 2020

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?

@@ -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'),
Copy link
Member

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

@nicolas-grekas nicolas-grekas added this to the 5.2 milestone Oct 6, 2020
@nicolas-grekas nicolas-grekas changed the base branch from master to 5.x October 6, 2020 16:28
@nicolas-grekas
Copy link
Member

Thank you @jschaedl.

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.

[FrameworkBundle] ConfigDumpReferenceCommand uses yaml even when not present
6 participants