diff --git a/UPGRADE-3.3.md b/UPGRADE-3.3.md index b8d2524654..7f61c71f57 100644 --- a/UPGRADE-3.3.md +++ b/UPGRADE-3.3.md @@ -72,6 +72,8 @@ Console have been deprecated in favor of the `console.error` event and the `ConsoleErrorEvent` class. The deprecated event and class will be removed in 4.0. + * The `SymfonyQuestionHelper::ask` default validation has been deprecated and will be removed in 4.0. Apply validation using `Question::setValidator` instead. + Debug ----- diff --git a/UPGRADE-4.0.md b/UPGRADE-4.0.md index ca1f8f10e1..32248ac4e0 100644 --- a/UPGRADE-4.0.md +++ b/UPGRADE-4.0.md @@ -61,6 +61,8 @@ Console * The `console.exception` event and the related `ConsoleExceptionEvent` class have been removed in favor of the `console.error` event and the `ConsoleErrorEvent` class. + * The `SymfonyQuestionHelper::ask` default validation has been removed in favor of `Question::setValidator`. + Debug ----- diff --git a/src/Symfony/Bundle/WebServerBundle/Command/ServerStartCommand.php b/src/Symfony/Bundle/WebServerBundle/Command/ServerStartCommand.php index 57de788608..af90a53f32 100644 --- a/src/Symfony/Bundle/WebServerBundle/Command/ServerStartCommand.php +++ b/src/Symfony/Bundle/WebServerBundle/Command/ServerStartCommand.php @@ -93,7 +93,7 @@ EOF 'You can either install it or use the "server:run" command instead.', )); - if ($io->ask('Do you want to execute server:run immediately? [yN] ', false)) { + if ($io->confirm('Do you want to execute server:run immediately?', false)) { return $this->getApplication()->find('server:run')->run($input, $output); } diff --git a/src/Symfony/Component/Console/CHANGELOG.md b/src/Symfony/Component/Console/CHANGELOG.md index b337ecf992..616f70e137 100644 --- a/src/Symfony/Component/Console/CHANGELOG.md +++ b/src/Symfony/Component/Console/CHANGELOG.md @@ -18,6 +18,7 @@ CHANGELOG * deprecated console.exception event in favor of console.error * added ability to handle `CommandNotFoundException` through the `console.error` event +* deprecated default validation in `SymfonyQuestionHelper::ask` 3.2.0 ------ diff --git a/src/Symfony/Component/Console/Helper/SymfonyQuestionHelper.php b/src/Symfony/Component/Console/Helper/SymfonyQuestionHelper.php index 25e094a04f..cf071d594d 100644 --- a/src/Symfony/Component/Console/Helper/SymfonyQuestionHelper.php +++ b/src/Symfony/Component/Console/Helper/SymfonyQuestionHelper.php @@ -29,6 +29,8 @@ class SymfonyQuestionHelper extends QuestionHelper { /** * {@inheritdoc} + * + * To be removed in 4.0 */ public function ask(InputInterface $input, OutputInterface $output, Question $question) { @@ -39,6 +41,8 @@ class SymfonyQuestionHelper extends QuestionHelper } else { // make required if (!is_array($value) && !is_bool($value) && 0 === strlen($value)) { + @trigger_error('The default question validator is deprecated since Symfony 3.3 and will not be used anymore in version 4.0. Set a custom question validator if needed.', E_USER_DEPRECATED); + throw new LogicException('A value is required.'); } }