diff --git a/src/CommandLine/Parser.php b/src/CommandLine/Parser.php index c537ec4..e190e5a 100644 --- a/src/CommandLine/Parser.php +++ b/src/CommandLine/Parser.php @@ -117,7 +117,14 @@ public function parse(array $args = null): array } } - if (!empty($opt[self::ENUM]) && !in_array($arg, $opt[self::ENUM], true) && !($opt[self::OPTIONAL] && $arg === true)) { + if ( + !empty($opt[self::ENUM]) + && !in_array($arg, $opt[self::ENUM], true) + && !( + $opt[self::OPTIONAL] + && $arg === true + ) + ) { throw new \Exception("Value of option $name must be " . implode(', or ', $opt[self::ENUM]) . '.'); } $this->checkArg($opt, $arg);