Skip to content

Commit

Permalink
Merge pull request #76 from adrianosferreira/not-exact-alias-version
Browse files Browse the repository at this point in the history
Don't try to parse aliases versions which doesn't contain exact version
  • Loading branch information
Seldaek authored Jan 13, 2020
2 parents 2667cf1 + 79fef23 commit 48bf3c3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/VersionParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ public function normalize($version, $fullVersion = null)

// strip off aliasing
if (preg_match('{^([^,\s]++) ++as ++([^,\s]++)$}', $version, $match)) {
// verify that the alias is a version without constraint
$this->normalize($match[2]);

$version = $match[1];
}

Expand Down
4 changes: 4 additions & 0 deletions tests/VersionParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ public function failingNormalizedVersions()
'non-dev arbitrary' => array('feature-foo'),
'metadata w/ space' => array('1.0.0+foo bar'),
'maven style release' => array('1.0.1-SNAPSHOT'),
'Alias and caret' => array('1.0.0+foo as ^2.0'),
'Alias and tilde' => array('1.0.0+foo as ~2.0'),
'Alias and greater than' => array('1.0.0+foo as >2.0'),
'Alias and less than' => array('1.0.0+foo as <2.0'),
);
}

Expand Down

0 comments on commit 48bf3c3

Please sign in to comment.