Skip to content

Commit

Permalink
[console] Add validator parameter to askEmpty method. (#292)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmolivas committed Jan 22, 2018
1 parent 413fd78 commit 51ddcb2
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/Style/DrupalStyle.php
Expand Up @@ -130,17 +130,19 @@ function ($answer) {
/**
* @param string $question
* @param string $default
* @param null|callable $validator
*
* @return string
*/
public function askEmpty($question, $default = '')
public function askEmpty($question, $default = '', $validator = null)
{
$question = new Question($question, $default);
$question->setValidator(
function ($answer) {
if (!$validator) {
$validator = function ($answer) {
return $answer;
}
);
};
}
$question->setValidator($validator);

return trim($this->askQuestion($question));
}
Expand Down

0 comments on commit 51ddcb2

Please sign in to comment.