Skip to content

Commit

Permalink
Fix conversion of && range version
Browse files Browse the repository at this point in the history
  • Loading branch information
francoispluchino committed Feb 15, 2017
1 parent 41520c8 commit dacfc81
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Converter/SemverConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,15 @@ public function convertRange($range)
*/
protected function cleanRange($range)
{
foreach (array('<', '>', '=', '~', '^', '||') as $character) {
foreach (array('<', '>', '=', '~', '^', '||', '&&') as $character) {
$range = str_replace($character.' ', $character, $range);
}

$range = preg_replace('/(?:[vV])(\d+)/', '${1}', $range);
$range = str_replace(' ||', '||', $range);
$range = str_replace(array(' &&', '&&'), ',', $range);

return str_replace(' ||', '||', $range);
return $range;
}

/**
Expand Down
1 change: 1 addition & 0 deletions Tests/Converter/SemverConverterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ public function getTestRanges()
array('>=1.2 <2.0', '>=1.2,<2.0'),
array('>=1 <2', '>=1,<2'),
array('>=1.0 <1.1 || >=1.2', '>=1.0,<1.1|>=1.2'),
array('>=1.0 && <1.1 || >=1.2', '>=1.0,<1.1|>=1.2'),
array('< 1.2.3', '<1.2.3'),
array('> 1.2.3', '>1.2.3'),
array('<= 1.2.3', '<=1.2.3'),
Expand Down

0 comments on commit dacfc81

Please sign in to comment.