Allow using OutputInterface::VERBOSITY_* constants in PHP config#439
Allow using OutputInterface::VERBOSITY_* constants in PHP config#439HeahDude wants to merge 1 commit intosymfony:3.xfrom
OutputInterface::VERBOSITY_* constants in PHP config#439Conversation
There was a problem hiding this comment.
👍🏻 for allowing constant instead of "magic" strings.
There is a 2nd transformation of constant name to constant value in the config validation callback. All that may be simplified by converting to const values in the normalization.
The only drawback is that there will be int displayed instead of constant names when using debug:config.
| $map = []; | ||
| $verbosities = ['VERBOSITY_QUIET', 'VERBOSITY_NORMAL', 'VERBOSITY_VERBOSE', 'VERBOSITY_VERY_VERBOSE', 'VERBOSITY_DEBUG']; | ||
| // allow numeric indexed array with ascendning verbosity and lowercase names of the constants | ||
| $verbosityConstants = [OutputInterface::VERBOSITY_QUIET, OutputInterface::VERBOSITY_NORMAL, OutputInterface::VERBOSITY_VERBOSE, OutputInterface::VERBOSITY_VERY_VERBOSE, OutputInterface::VERBOSITY_DEBUG]; |
There was a problem hiding this comment.
The array should look like [OutputInterface::VERBOSITY_QUIET => 'VERBOSITY_QUIET', ...] to remove the array_search and make the code more readable.
There was a problem hiding this comment.
I think we can make the code a little clearer with this changes: HeahDude#1
|
Hi @HeahDude, do you want to rebase this PR after merging HeahDude#1 (if you agree with its changes of-course)? |
While trying to improve some configuration blocks in Symfony docs, I found out that it was not possible to use constants for the verbosity levels of the console handler.
I think it's missing now that we tend to spread PHP config files such as
config/packages/monolog.php.Before this patch one gets the following exception: