fixed PHP 5.3 compat

This commit is contained in:
Fabien Potencier 2015-01-25 06:50:37 +01:00
parent 2570042937
commit 92da9964ad
1 changed files with 3 additions and 2 deletions

View File

@ -44,13 +44,14 @@ class ConfirmationQuestion extends Question
private function getDefaultNormalizer()
{
$default = $this->getDefault();
$regex = $this->trueAnswerRegex;
return function ($answer) use ($default) {
return function ($answer) use ($default, $regex) {
if (is_bool($answer)) {
return $answer;
}
$answerIsTrue = (bool) preg_match($this->trueAnswerRegex, $answer);
$answerIsTrue = (bool) preg_match($regex, $answer);
if (false === $default) {
return $answer && $answerIsTrue;
}