Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Console] invalid default returned from ChoiceQuestion on non interactive mode when using SymfonyStyle #25470

Closed
@mathroc

Description

@mathroc
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version 3.3.x

the choice index is returned instead of the choice value when a default choice is specified and the command is executed with -n

the default value is set to the choice index here : https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Console/Style/SymfonyStyle.php#L230

so I’ve tried to run $io->askQuestion(new ChoiceQuestion($question, $choices, $default)); directly. it works on non interactive mode but fails on interactive mode

I think ChoiceQuestion should override getDefault() to solve this. I can make a PR for this but will this considered a BC break ? or does it falls in the bug fix category ?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions