Skip to content

Commit

Permalink
Remove unnecessary if expr
Browse files Browse the repository at this point in the history
  • Loading branch information
c9s committed Jul 18, 2016
1 parent e86ab18 commit 7ec61fc
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/OptionParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,11 @@ public function parse(array $argv)
if (!$spec) {
throw new InvalidOptionException('Invalid option: '.$arg);
}
if ($spec->isRequired() || $spec->isMultiple() || $spec->isOptional() || $spec->isFlag()) {
$i += $this->consumeOptionToken($spec, $arg, $next);
$result->set($spec->getId(), $spec);
} else {
throw new Exception('Unknown option type');
}

// This if expr might be unnecessary, becase we have default mode - flag
// if ($spec->isRequired() || $spec->isMultiple() || $spec->isOptional() || $spec->isFlag()) {
$i += $this->consumeOptionToken($spec, $arg, $next);
$result->set($spec->getId(), $spec);
}

return $result;
Expand Down

0 comments on commit 7ec61fc

Please sign in to comment.