|
|
|
@ -128,10 +128,7 @@ class VersionParser
|
|
|
|
|
if ('stable' === $matches[$index]) {
|
|
|
|
|
return $version;
|
|
|
|
|
}
|
|
|
|
|
$mod = array('{^pl?$}i', '{^rc$}i');
|
|
|
|
|
$modNormalized = array('patch', 'RC');
|
|
|
|
|
$version .= '-'.preg_replace($mod, $modNormalized, strtolower($matches[$index]))
|
|
|
|
|
. (!empty($matches[$index+1]) ? $matches[$index+1] : '');
|
|
|
|
|
$version .= '-' . $this->expandStability($matches[$index]) . (!empty($matches[$index+1]) ? $matches[$index+1] : '');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!empty($matches[$index+2])) {
|
|
|
|
@ -259,22 +256,30 @@ class VersionParser
|
|
|
|
|
return array();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (preg_match('{^~(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:\.(\d+))?$}', $constraint, $matches)) {
|
|
|
|
|
if (isset($matches[4])) {
|
|
|
|
|
if (preg_match('{^~(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:\.(\d+))?'.self::$modifierRegex.'?$}', $constraint, $matches)) {
|
|
|
|
|
if (isset($matches[4]) && '' !== $matches[4]) {
|
|
|
|
|
$highVersion = $matches[1] . '.' . $matches[2] . '.' . ($matches[3] + 1) . '.0-dev';
|
|
|
|
|
$lowVersion = $matches[1] . '.' . $matches[2] . '.' . $matches[3]. '.' . $matches[4];
|
|
|
|
|
} elseif (isset($matches[3])) {
|
|
|
|
|
} elseif (isset($matches[3]) && '' !== $matches[3]) {
|
|
|
|
|
$highVersion = $matches[1] . '.' . ($matches[2] + 1) . '.0.0-dev';
|
|
|
|
|
$lowVersion = $matches[1] . '.' . $matches[2] . '.' . $matches[3]. '.0';
|
|
|
|
|
} else {
|
|
|
|
|
$highVersion = ($matches[1] + 1) . '.0.0.0-dev';
|
|
|
|
|
if (isset($matches[2])) {
|
|
|
|
|
if (isset($matches[2]) && '' !== $matches[2]) {
|
|
|
|
|
$lowVersion = $matches[1] . '.' . $matches[2] . '.0.0';
|
|
|
|
|
} else {
|
|
|
|
|
$lowVersion = $matches[1] . '.0.0.0';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!empty($matches[5])) {
|
|
|
|
|
$lowVersion .= '-' . $this->expandStability($matches[5]) . (!empty($matches[6]) ? $matches[6] : '');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!empty($matches[7])) {
|
|
|
|
|
$lowVersion .= '-dev';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return array(
|
|
|
|
|
new VersionConstraint('>=', $lowVersion),
|
|
|
|
|
new VersionConstraint('<', $highVersion),
|
|
|
|
@ -337,6 +342,25 @@ class VersionParser
|
|
|
|
|
throw new \UnexpectedValueException($message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private function expandStability($stability)
|
|
|
|
|
{
|
|
|
|
|
$stability = strtolower($stability);
|
|
|
|
|
|
|
|
|
|
switch ($stability) {
|
|
|
|
|
case 'a':
|
|
|
|
|
return 'alpha';
|
|
|
|
|
case 'b':
|
|
|
|
|
return 'beta';
|
|
|
|
|
case 'p':
|
|
|
|
|
case 'pl':
|
|
|
|
|
return 'patch';
|
|
|
|
|
case 'rc':
|
|
|
|
|
return 'RC';
|
|
|
|
|
default:
|
|
|
|
|
return $stability;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Parses a name/version pairs and returns an array of pairs + the
|
|
|
|
|
*
|
|
|
|
|