Add support for arbitrary values for the references in version constraints
parent
80c18db694
commit
97dfbefa72
|
@ -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];
|
||||
}
|
||||
|
||||
|
|
|
@ -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'),
|
||||
|
|
Loading…
Reference in New Issue