[Console] replaced var_export with json_encode for default values when exported as text/xml to make them more readable (closes #4193)

This commit is contained in:
Fabien Potencier 2012-07-10 13:24:16 +02:00
parent 5487a1f076
commit 7a181002d5
3 changed files with 6 additions and 10 deletions

View File

@ -526,10 +526,6 @@ class InputDefinition
private function formatDefaultValue($default)
{
if (is_array($default) && $default === array_values($default)) {
return sprintf("array('%s')", implode("', '", $default));
}
return str_replace("\n", '', var_export($default, true));
return json_encode($default);
}
}

View File

@ -3,7 +3,7 @@ Usage:
Arguments:
command The command to execute
command_name The command name (default: 'help')
command_name The command name (default: "help")
Options:
--xml To output help as XML

View File

@ -1,11 +1,11 @@
<comment>Arguments:</comment>
<info>foo </info> The foo argument
<info>baz </info> The baz argument<comment> (default: true)</comment>
<info>bar </info> The bar argument<comment> (default: array('bar'))</comment>
<info>bar </info> The bar argument<comment> (default: ["bar"])</comment>
<comment>Options:</comment>
<info>--foo</info> (-f) The foo option
<info>--baz</info> The baz option<comment> (default: false)</comment>
<info>--bar</info> (-b) The bar option<comment> (default: 'bar')</comment>
<info>--qux</info> The qux option<comment> (default: array('foo', 'bar'))</comment><comment> (multiple values allowed)</comment>
<info>--qux2</info> The qux2 option<comment> (default: array ( 'foo' => 'bar',))</comment><comment> (multiple values allowed)</comment>
<info>--bar</info> (-b) The bar option<comment> (default: "bar")</comment>
<info>--qux</info> The qux option<comment> (default: ["foo","bar"])</comment><comment> (multiple values allowed)</comment>
<info>--qux2</info> The qux2 option<comment> (default: {"foo":"bar"})</comment><comment> (multiple values allowed)</comment>