diff --git a/components/console/helpers/questionhelper.rst b/components/console/helpers/questionhelper.rst index d6cdb7c67ab..664f1b0d1df 100644 --- a/components/console/helpers/questionhelper.rst +++ b/components/console/helpers/questionhelper.rst @@ -384,6 +384,9 @@ You can also use a validator with a hidden question:: $helper = $this->getHelper('question'); $question = new Question('Please enter your password'); + $question->setNormalizer(function ($value) { + return null === $value ? '' : $value; + }); $question->setValidator(function ($value) { if (trim($value) == '') { throw new \Exception('The password cannot be empty');