Skip to content

Commit

Permalink
Fix conversion of version with only major version
Browse files Browse the repository at this point in the history
  • Loading branch information
francoispluchino committed May 28, 2016
1 parent 2bc14ef commit e17c082
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Converter/SemverConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ protected function matchRangeTokenStep4($i, $match, array &$matches, &$special,
$change = count($version) - 2;
$version[$change] = intval($version[$change]) + 1;
$match = str_replace(array('*', 'x', 'X'), '0', implode('.', $version));
} elseif (null === $special && $i === 0 && false === strpos($match, '.') && is_numeric($match)) {
$match = '~'.$match;
} else {
$match = '~' === $special ? str_replace(array('*', 'x', 'X'), '0', $match) : $match;
}
Expand Down
1 change: 1 addition & 0 deletions Tests/Converter/SemverConverterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ public function getTestRanges()
array('<=1.2.3', '<=1.2.3'),
array('~1.2.3', '~1.2.3'),
array('~1', '~1'),
array('1', '~1'),
array('^1.2.3', '>=1.2.3,<2.0.0'),
array('^1.2', '>=1.2.0,<2.0.0'),
array('^1.x', '>=1.0.0,<2.0.0'),
Expand Down

0 comments on commit e17c082

Please sign in to comment.