1
0
Fork 0

Merge branch '1.0'

pull/5238/head
Jordi Boggiano 2016-04-22 23:00:13 +01:00
commit 8771119374
2 changed files with 15 additions and 9 deletions

View File

@ -201,16 +201,18 @@ class RootPackageLoader extends ArrayLoader
continue; continue;
} }
// infer flags for requirements that have an explicit -dev or -beta version specified but only foreach ($constraints as $constraint) {
// for those that are more unstable than the minimumStability or existing flags // infer flags for requirements that have an explicit -dev or -beta version specified but only
$reqVersion = preg_replace('{^([^,\s@]+) as .+$}', '$1', $reqVersion); // for those that are more unstable than the minimumStability or existing flags
if (preg_match('{^[^,\s@]+$}', $reqVersion) && 'stable' !== ($stabilityName = VersionParser::parseStability($reqVersion))) { $reqVersion = preg_replace('{^([^,\s@]+) as .+$}', '$1', $constraint);
$name = strtolower($reqName); if (preg_match('{^[^,\s@]+$}', $reqVersion) && 'stable' !== ($stabilityName = VersionParser::parseStability($reqVersion))) {
$stability = $stabilities[$stabilityName]; $name = strtolower($reqName);
if ((isset($stabilityFlags[$name]) && $stabilityFlags[$name] > $stability) || ($minimumStability > $stability)) { $stability = $stabilities[$stabilityName];
continue; if ((isset($stabilityFlags[$name]) && $stabilityFlags[$name] > $stability) || ($minimumStability > $stability)) {
continue;
}
$stabilityFlags[$name] = $stability;
} }
$stabilityFlags[$name] = $stability;
} }
} }

View File

@ -44,6 +44,8 @@ class RootPackageLoaderTest extends \PHPUnit_Framework_TestCase
'zux/complex' => '~1.0,>=1.0.2@dev', 'zux/complex' => '~1.0,>=1.0.2@dev',
'or/op' => '^2.0@dev || ^2.0@dev', 'or/op' => '^2.0@dev || ^2.0@dev',
'multi/lowest-wins' => '^2.0@rc || >=3.0@dev , ~3.5@alpha', 'multi/lowest-wins' => '^2.0@rc || >=3.0@dev , ~3.5@alpha',
'or/op/without-flags' => 'dev-master || 2.0 , ~3.5-alpha',
'or/op/without-flags2' => '3.0-beta || 2.0 , ~3.5-alpha',
), ),
'minimum-stability' => 'alpha', 'minimum-stability' => 'alpha',
)); ));
@ -55,6 +57,8 @@ class RootPackageLoaderTest extends \PHPUnit_Framework_TestCase
'zux/complex' => BasePackage::STABILITY_DEV, 'zux/complex' => BasePackage::STABILITY_DEV,
'or/op' => BasePackage::STABILITY_DEV, 'or/op' => BasePackage::STABILITY_DEV,
'multi/lowest-wins' => BasePackage::STABILITY_DEV, 'multi/lowest-wins' => BasePackage::STABILITY_DEV,
'or/op/without-flags' => BasePackage::STABILITY_DEV,
'or/op/without-flags2' => BasePackage::STABILITY_ALPHA,
), $package->getStabilityFlags()); ), $package->getStabilityFlags());
} }