Skip to content

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

Closed
@igorw

Description

@igorw

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" ]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions