8000 [Console] Fix validation of null values using SymfonyStyle::ask() · symfony/symfony@b170780 · GitHub
[go: up one dir, main page]

Skip to content

Commit b170780

Browse files
committed
[Console] Fix validation of null values using SymfonyStyle::ask()
1 parent fcd401f commit b170780

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ public function ask(InputInterface $input, OutputInterface $output, Question $qu
3535
$question->setValidator(function ($value) use ($validator) {
3636
if (null !== $validator) {
3737
$value = $validator($value);
38-
}
39-
40-
// make required
41-
if (!is_array($value) && !is_bool($value) && 0 === strlen($value)) {
42-
throw new LogicException('A value is required.');
38+
} else {
39+
// make required
40+
if (!is_array($value) && !is_bool($value) && 0 === strlen($value)) {
41+
throw new LogicException('A value is required.');
42+
}
4343
}
4444

4545
return $value;

0 commit comments

Comments
 (0)
0