Infer stability flags for requirements that have an explicit version required of a lower stability
parent
fabf5c2f6d
commit
a3018c43eb
|
@ -119,6 +119,7 @@ class RootPackageLoader extends ArrayLoader
|
||||||
{
|
{
|
||||||
$stabilities = BasePackage::$stabilities;
|
$stabilities = BasePackage::$stabilities;
|
||||||
foreach ($requires as $reqName => $reqVersion) {
|
foreach ($requires as $reqName => $reqVersion) {
|
||||||
|
// parse explicit stability flags
|
||||||
if (preg_match('{^[^,\s]*?@('.implode('|', $stabilities).')$}i', $reqVersion, $match)) {
|
if (preg_match('{^[^,\s]*?@('.implode('|', $stabilities).')$}i', $reqVersion, $match)) {
|
||||||
$name = strtolower($reqName);
|
$name = strtolower($reqName);
|
||||||
$stability = array_search(VersionParser::normalizeStability($match[1]), $stabilities);
|
$stability = array_search(VersionParser::normalizeStability($match[1]), $stabilities);
|
||||||
|
@ -127,6 +128,18 @@ class RootPackageLoader extends ArrayLoader
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$stabilityFlags[$name] = $stability;
|
$stabilityFlags[$name] = $stability;
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// infer flags for requirements that have an explicit -dev or -beta version specified for example
|
||||||
|
if (preg_match('{^[^,\s@]+$}', $reqVersion) && 'stable' !== ($stabilityName = VersionParser::parseStability($reqVersion))) {
|
||||||
|
$name = strtolower($reqName);
|
||||||
|
$stability = array_search($stabilityName, $stabilities);
|
||||||
|
if (isset($stabilityFlags[$name]) && $stabilityFlags[$name] > $stability) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$stabilityFlags[$name] = $stability;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue