Skip to content

Commit

Permalink
Fix input validation by using only known config values
Browse files Browse the repository at this point in the history
  • Loading branch information
nochso committed Jan 26, 2016
1 parent 005aa6b commit 03d69c7
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/PHPSemVerChecker/Console/InputMerger.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,21 @@ public function merge(InputInterface $input, Configuration $config)
if ($input->hasArgumentSet($argument)) {
$config->set($argument, $value);
} else {
$input->setArgument($argument, $config->get($argument));
$configValue = $config->get($argument);
if ($configValue !== null) {
$input->setArgument($argument, $config->get($argument));
}
}
}

foreach ($input->getOptions() as $option => $value) {
if ($input->hasOptionSet($option)) {
$config->set($option, $value);
} else {
$input->setOption($option, $config->get($option));
$configValue = $config->get($option);
if ($configValue !== null) {
$input->setOption($option, $configValue);
}
}
}
}
Expand Down

0 comments on commit 03d69c7

Please sign in to comment.