Skip to content

Commit e9b78a0

Browse files
committed
fix console helpers
1 parent 7fafe9a commit e9b78a0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Traits/ConsoleHelpersTrait.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ protected function getOptionOrAsk(string $optionName, string $question, $default
4747
{
4848
$value = $this->getTrimmedOption($optionName);
4949

50-
if (empty($value)) {
50+
if ($value === '' || $value === null) {
5151
$value = trim($this->ask($question, $default));
5252
}
5353

@@ -74,9 +74,9 @@ protected function getOptionOrChoice(string $optionName, string $question, array
7474
{
7575
$value = $this->getTrimmedOption($optionName);
7676

77-
if (empty($value)) {
77+
if ($value === '' || $value === null) {
7878
$value = trim($this->choice($question, $choices, $default));
79-
} elseif (! in_array(mb_strtolower($value), $choices, true)) {
79+
} elseif (!in_array(mb_strtolower($value), $choices, true)) {
8080
throw new InvalidOptionException(
8181
sprintf(
8282
'Wrong "%s" option value provided. Value should be one of "%s".',
@@ -101,7 +101,7 @@ protected function getOptionOneOf(string $optionName, array $validValues): strin
101101
{
102102
$value = $this->getTrimmedOption($optionName);
103103

104-
if (! in_array(mb_strtolower($value), $validValues, true)) {
104+
if (!in_array(mb_strtolower($value), $validValues, true)) {
105105
throw new InvalidOptionException(
106106
sprintf(
107107
'Wrong "%s" option value provided. Value should be one of "%s".',

0 commit comments

Comments
 (0)