Skip to content

[Console] Array default values should not use var_export #4193

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

Closed
igorw opened this issue May 3, 2012 · 1 comment
Closed

[Console] Array default values should not use var_export #4193

igorw opened this issue May 3, 2012 · 1 comment
Labels

Comments

@igorw
Copy link
Contributor

igorw commented May 3, 2012

The code for printing default values of input options is:

$default = sprintf('<comment> (default: %s)</comment>', is_bool($argument->getDefault()) || is_array($argument->getDefault()) ? str_replace("\n", '', var_export($argument->getDefault(), true)): $argument->getDefault());

The use of var_export for arrays is not a good choice, as it produces quite verbose and unreadable output:

var_export(array('foo'));

Produces:

array (  0 => 'foo',)

Better would be:

array("foo")

Or even:

[ "foo" ]
@GromNaN
Copy link
Member

GromNaN commented May 3, 2012

json_encode produces ["foo"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants