1
0
Fork 0

Switched to QuestionHelper

pull/3983/head
Rob Bast 2015-04-30 12:09:56 +02:00
parent ee4044efcd
commit 7279c25839
1 changed files with 17 additions and 10 deletions

View File

@ -16,6 +16,8 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\ConsoleOutputInterface; use Symfony\Component\Console\Output\ConsoleOutputInterface;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Helper\HelperSet; use Symfony\Component\Console\Helper\HelperSet;
use Symfony\Component\Console\Question\ConfirmationQuestion;
use Symfony\Component\Console\Question\Question;
use Symfony\Component\Process\ExecutableFinder; use Symfony\Component\Process\ExecutableFinder;
/** /**
@ -208,10 +210,11 @@ class ConsoleIO extends BaseIO
$output = $output->getErrorOutput(); $output = $output->getErrorOutput();
} }
/** @var \Symfony\Component\Console\Helper\DialogHelper $dialog */ /** @var \Symfony\Component\Console\Helper\QuestionHelper $helper */
$dialog = $this->helperSet->get('dialog'); $helper = $this->helperSet->get('question');
$question = new Question($question, $default);
return $dialog->ask($output, $question, $default); return $helper->ask($this->input, $output, $question);
} }
/** /**
@ -225,16 +228,17 @@ class ConsoleIO extends BaseIO
$output = $output->getErrorOutput(); $output = $output->getErrorOutput();
} }
/** @var \Symfony\Component\Console\Helper\DialogHelper $dialog */ /** @var \Symfony\Component\Console\Helper\QuestionHelper $helper */
$dialog = $this->helperSet->get('dialog'); $helper = $this->helperSet->get('question');
$question = new ConfirmationQuestion($question, $default);
return $dialog->askConfirmation($output, $question, $default); return $helper->ask($this->input, $output, $question);
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function askAndValidate($question, $validator, $attempts = false, $default = null) public function askAndValidate($question, $validator, $attempts = null, $default = null)
{ {
$output = $this->output; $output = $this->output;
@ -242,10 +246,13 @@ class ConsoleIO extends BaseIO
$output = $output->getErrorOutput(); $output = $output->getErrorOutput();
} }
/** @var \Symfony\Component\Console\Helper\DialogHelper $dialog */ /** @var \Symfony\Component\Console\Helper\QuestionHelper $helper */
$dialog = $this->helperSet->get('dialog'); $helper = $this->helperSet->get('question');
$question = new Question($question, $default);
$question->setValidator($validator);
$question->setMaxAttempts($attempts);
return $dialog->askAndValidate($output, $question, $validator, $attempts, $default); return $helper->ask($this->input, $output, $question);
} }
/** /**