Skip to content

Commit 48bf3c3

Browse files
authored
Merge pull request #76 from adrianosferreira/not-exact-alias-version
Don't try to parse aliases versions which doesn't contain exact version
2 parents 2667cf1 + 79fef23 commit 48bf3c3

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/VersionParser.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ public function normalize($version, $fullVersion = null)
108108

109109
// strip off aliasing
110110
if (preg_match('{^([^,\s]++) ++as ++([^,\s]++)$}', $version, $match)) {
111+
// verify that the alias is a version without constraint
112+
$this->normalize($match[2]);
113+
111114
$version = $match[1];
112115
}
113116

tests/VersionParserTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ public function failingNormalizedVersions()
123123
'non-dev arbitrary' => array('feature-foo'),
124124
'metadata w/ space' => array('1.0.0+foo bar'),
125125
'maven style release' => array('1.0.1-SNAPSHOT'),
126+
'Alias and caret' => array('1.0.0+foo as ^2.0'),
127+
'Alias and tilde' => array('1.0.0+foo as ~2.0'),
128+
'Alias and greater than' => array('1.0.0+foo as >2.0'),
129+
'Alias and less than' => array('1.0.0+foo as <2.0'),
126130
);
127131
}
128132

0 commit comments

Comments
 (0)