Open
Description
Description
Currently, when creating a new Symfony command and using the choice question, like this :
return $io->choice($question, $choices, $default);
It returns the value. But I want the key ! It could be great to give the choice to send key or value with a booleen parameter, like this :
return $io->choice($question, $choices, $default, false);
Example
$choices = [
0 => 'red',
1 => 'blue',
2 => 'orange'
];
return $io->choice('Choose a color', $choices, 0); // Returns the value (red, blur or orange)
return $io->choice('Choose a color', $choices, 0, false); // Returns the key (0, 1 or 2)