1
0
Fork 0

Add support for arbitrary values for the references in version constraints

pull/1576/merge
Jordi Boggiano 2013-02-13 13:26:27 +01:00
parent 80c18db694
commit 97dfbefa72
2 changed files with 5 additions and 2 deletions

View File

@ -35,7 +35,7 @@ class VersionParser
*/
public static function parseStability($version)
{
$version = preg_replace('{#[a-f0-9]+$}i', '', $version);
$version = preg_replace('{#.+$}i', '', $version);
if ('dev-' === substr($version, 0, 4) || '-dev' === substr($version, -4)) {
return 'dev';
@ -217,7 +217,7 @@ class VersionParser
$constraints = empty($match[1]) ? '*' : $match[1];
}
if (preg_match('{^(dev-[^,\s@]+?|[^,\s@]+?\.x-dev)#[a-f0-9]+$}i', $constraints, $match)) {
if (preg_match('{^(dev-[^,\s@]+?|[^,\s@]+?\.x-dev)#.+$}i', $constraints, $match)) {
$constraints = $match[1];
}

View File

@ -165,6 +165,7 @@ class VersionParserTest extends \PHPUnit_Framework_TestCase
{
$parser = new VersionParser;
$this->assertSame((string) new VersionConstraint('=', '1.0.9999999.9999999-dev'), (string) $parser->parseConstraints('1.0.x-dev#abcd123'));
$this->assertSame((string) new VersionConstraint('=', '1.0.9999999.9999999-dev'), (string) $parser->parseConstraints('1.0.x-dev#trunk/@123'));
}
/**
@ -174,6 +175,7 @@ class VersionParserTest extends \PHPUnit_Framework_TestCase
{
$parser = new VersionParser;
$this->assertSame((string) new VersionConstraint('=', '1.0.0.0'), (string) $parser->parseConstraints('1.0#abcd123'));
$this->assertSame((string) new VersionConstraint('=', '1.0.0.0'), (string) $parser->parseConstraints('1.0#trunk/@123'));
}
/**
@ -320,6 +322,7 @@ class VersionParserTest extends \PHPUnit_Framework_TestCase
array('stable', '1.0'),
array('dev', 'v2.0.x-dev'),
array('dev', 'v2.0.x-dev#abc123'),
array('dev', 'v2.0.x-dev#trunk/@123'),
array('RC', '3.0-RC2'),
array('dev', 'dev-master'),
array('dev', '3.1.2-dev'),