Skip to content

Commit 47c93ee

Browse files
Merge branch '2.0'
2 parents a540d9b + 3a3cd12 commit 47c93ee

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Parser.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function parse(array $argv, string $shortOptions, ?array $longOptions = n
5353
$options = [];
5454
$nonOptions = [];
5555

56-
if ($longOptions) {
56+
if ($longOptions !== null) {
5757
sort($longOptions);
5858
}
5959

@@ -82,7 +82,7 @@ public function parse(array $argv, string $shortOptions, ?array $longOptions = n
8282
break;
8383
}
8484

85-
if ($arg[0] !== '-' || (strlen($arg) > 1 && $arg[1] === '-' && !$longOptions)) {
85+
if ($arg[0] !== '-' || (strlen($arg) > 1 && $arg[1] === '-' && $longOptions === null)) {
8686
$nonOptions[] = $arg;
8787

8888
continue;
@@ -135,7 +135,7 @@ private function parseShortOption(string $argument, string $shortOptions, array
135135
if (!(strlen($spec) > 2 && $spec[2] === ':')) {
136136
$optionArgument = current($argv);
137137

138-
if (!$optionArgument) {
138+
if ($optionArgument === false) {
139139
throw new RequiredOptionArgumentMissingException('-' . $option);
140140
}
141141

@@ -191,7 +191,7 @@ private function parseLongOption(string $argument, array $longOptions, array &$o
191191

192192
next($argv);
193193
}
194-
} elseif ($optionArgument) {
194+
} elseif ($optionArgument !== null) {
195195
throw new OptionDoesNotAllowArgumentException('--' . $option);
196196
}
197197

0 commit comments

Comments
 (0)