Give clients the ability to declare that the FIELDS field came from default values, not from user-supplied values, by setting FIELDS_CAME_FROM_DEFAULT.
Description
When we declare the Symfony Console Input description for the --fields option, we give it the default values so that they may be rendered in the help output. However, doing this means that the FormatterOptions::FIELDS field is set with the result of fetching the value of this Input object, and there currently is no way to tell if the value returned came from the user or the defaults. This subverts our feature where we can provide different default fields for human-readable output formats.
To fix this, we provide a new field, FIELDS_CAME_FROM_DEFAULT, which clients may call e.g. if $args->hasOption('fields') returns false.
Overview
This pull request:
Summary
Give clients the ability to declare that the FIELDS field came from default values, not from user-supplied values, by setting FIELDS_CAME_FROM_DEFAULT.
Description
When we declare the Symfony Console Input description for the
--fields
option, we give it the default values so that they may be rendered in the help output. However, doing this means that the FormatterOptions::FIELDS field is set with the result of fetching the value of this Input object, and there currently is no way to tell if the value returned came from the user or the defaults. This subverts our feature where we can provide different default fields for human-readable output formats.To fix this, we provide a new field, FIELDS_CAME_FROM_DEFAULT, which clients may call e.g. if
$args->hasOption('fields')
returnsfalse
.