Skip to content

Commit 2da429c

Browse files
committed
[Console] Make SymfonyQuestionHelper::ask optional by default
1 parent d662b21 commit 2da429c

File tree

5 files changed

+10
-1
lines changed

5 files changed

+10
-1
lines changed

UPGRADE-3.3.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ Console
7272
have been deprecated in favor of the `console.error` event and the `ConsoleErrorEvent`
7373
class. The deprecated event and class will be removed in 4.0.
7474

75+
* The `SymfonyQuestionHelper::ask` default validation has been deprecated and will be removed in 4.0. Apply validation using `Question::setValidator` instead.
76+
7577
Debug
7678
-----
7779

UPGRADE-4.0.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ Console
6161
* The `console.exception` event and the related `ConsoleExceptionEvent` class have
6262
been removed in favor of the `console.error` event and the `ConsoleErrorEvent` class.
6363

64+
* The `SymfonyQuestionHelper::ask` default validation has been removed in favor of `Question::setValidator`.
65+
6466
Debug
6567
-----
6668

src/Symfony/Bundle/WebServerBundle/Command/ServerStartCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
8888
'You can either install it or use the "server:run" command instead.',
8989
));
9090

91-
if ($io->ask('Do you want to execute <info>server:run</info> immediately? [yN] ', false)) {
91+
if ($io->confirm('Do you want to execute <info>server:run</info> immediately?', false)) {
9292
return $this->getApplication()->find('server:run')->run($input, $output);
9393
}
9494

src/Symfony/Component/Console/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ CHANGELOG
1212
* deprecated console.exception event in favor of console.error
1313
* added ability to handle `CommandNotFoundException` through the
1414
`console.error` event
15+
* deprecated default validation in `SymfonyQuestionHelper::ask`
1516

1617
3.2.0
1718
------

src/Symfony/Component/Console/Helper/SymfonyQuestionHelper.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ class SymfonyQuestionHelper extends QuestionHelper
2929
{
3030
/**
3131
* {@inheritdoc}
32+
*
33+
* To be removed in 4.0
3234
*/
3335
public function ask(InputInterface $input, OutputInterface $output, Question $question)
3436
{
@@ -39,6 +41,8 @@ public function ask(InputInterface $input, OutputInterface $output, Question $qu
3941
} else {
4042
// make required
4143
if (!is_array($value) && !is_bool($value) && 0 === strlen($value)) {
44+
@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);
45+
4246
throw new LogicException('A value is required.');
4347
}
4448
}

0 commit comments

Comments
 (0)