You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bug #50637 [FrameworkBundle] Fixed parsing new JSON output of debug:config not possible (Toflar)
This PR was squashed before being merged into the 6.3 branch.
Discussion
----------
[FrameworkBundle] Fixed parsing new JSON output of debug:config not possible
| Q | A
| ------------- | ---
| Branch? | 6.3
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets |
| License | MIT
| Doc PR |
See my comment to the original PR which introduced `debug:config --format=json`: symfony/symfony#48457 (comment)
Currently, it's not possible to parse the JSON output (neither is the YAML) which makes `--format=json` kind of pointless. The argument against this - I guess - is that the JSON format was introduced to make the command independent from the YAML component but still, why is `--format` an option then?
So I guess by delivering an additional option, we can fix this issue and make it parsable.
(Maybe instead of having `--no-tilte` we should call it `parsable` in the first place so that if in the future there's something on top of the title, the option would still be valid?)
Commits
-------
a3e8560631 [FrameworkBundle] Fixed parsing new JSON output of debug:config not possible
The <info>%command.name%</info> command dumps the current configuration for an
@@ -97,16 +97,18 @@ protected function execute(InputInterface $input, OutputInterface $output): int
97
97
98
98
$format = $input->getOption('format');
99
99
100
-
if ('yaml' === $format && !class_exists(Yaml::class)) {
101
-
$errorIo->error('Setting the "format" option to "yaml" requires the Symfony Yaml component. Try running "composer install symfony/yaml" or use "--format=json" instead.');
100
+
if (\in_array($format, ['txt', 'yml'], true) && !class_exists(Yaml::class)) {
101
+
$errorIo->error('Setting the "format" option to "txt" or "yaml" requires the Symfony Yaml component. Try running "composer install symfony/yaml" or use "--format=json" instead.');
102
102
103
103
return1;
104
104
}
105
105
106
106
if (null === $path = $input->getArgument('path')) {
107
-
$io->title(
108
-
sprintf('Current configuration for %s', $name === $extensionAlias ? sprintf('extension with alias "%s"', $extensionAlias) : sprintf('"%s"', $name))
109
-
);
107
+
if ('txt' === $input->getOption('format')) {
108
+
$io->title(
109
+
sprintf('Current configuration for %s', $name === $extensionAlias ? sprintf('extension with alias "%s"', $extensionAlias) : sprintf('"%s"', $name))
0 commit comments