Skip to content

Commit dacfc81

Browse files
Fix conversion of && range version
1 parent 41520c8 commit dacfc81

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

Converter/SemverConverter.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,15 @@ public function convertRange($range)
5555
*/
5656
protected function cleanRange($range)
5757
{
58-
foreach (array('<', '>', '=', '~', '^', '||') as $character) {
58+
foreach (array('<', '>', '=', '~', '^', '||', '&&') as $character) {
5959
$range = str_replace($character.' ', $character, $range);
6060
}
6161

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

64-
return str_replace(' ||', '||', $range);
66+
return $range;
6567
}
6668

6769
/**

Tests/Converter/SemverConverterTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ public function getTestRanges()
134134
array('>=1.2 <2.0', '>=1.2,<2.0'),
135135
array('>=1 <2', '>=1,<2'),
136136
array('>=1.0 <1.1 || >=1.2', '>=1.0,<1.1|>=1.2'),
137+
array('>=1.0 && <1.1 || >=1.2', '>=1.0,<1.1|>=1.2'),
137138
array('< 1.2.3', '<1.2.3'),
138139
array('> 1.2.3', '>1.2.3'),
139140
array('<= 1.2.3', '<=1.2.3'),

0 commit comments

Comments
 (0)