Skip to content

Commit 1eea697

Browse files
committed
fix: parse option error on elem is '-' or '--'
Signed-off-by: inhere <[email protected]>
1 parent 4f7d30a commit 1eea697

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Flags.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
use function preg_match;
2222
use function str_split;
2323
use function stripos;
24+
use function strlen;
2425
use function strpos;
2526
use function substr;
2627
use function trim;
@@ -138,8 +139,8 @@ public static function parseArgv(array $params, array $config = []): array
138139
continue;
139140
}
140141

141-
// is options
142-
if ($p[0] === '-') {
142+
// is options and not equals '-' '--'
143+
if ($p[0] === '-' && '' !== trim($p, '-')) {
143144
$value = true;
144145
$option = substr($p, 1);
145146
$isLong = false;

0 commit comments

Comments
 (0)