Normalize minimum-stability `rc` to `RC` in `InitCommand`
A `minimum-stability` of `rc` is valid according to `composer-schema.json` and works fine with install and update and generally in version comparisons, because it's normalized to `RC`. This commit makes it work in `InitCommand` and `RequireCommand` too.pull/8534/head
parent
b9d00153d9
commit
7d7e3d594b
|
@ -16,6 +16,7 @@ use Composer\DependencyResolver\Pool;
|
||||||
use Composer\Factory;
|
use Composer\Factory;
|
||||||
use Composer\Json\JsonFile;
|
use Composer\Json\JsonFile;
|
||||||
use Composer\Package\BasePackage;
|
use Composer\Package\BasePackage;
|
||||||
|
use Composer\Package\Package;
|
||||||
use Composer\Package\Version\VersionParser;
|
use Composer\Package\Version\VersionParser;
|
||||||
use Composer\Package\Version\VersionSelector;
|
use Composer\Package\Version\VersionSelector;
|
||||||
use Composer\Repository\CompositeRepository;
|
use Composer\Repository\CompositeRepository;
|
||||||
|
@ -702,13 +703,13 @@ EOT
|
||||||
private function getMinimumStability(InputInterface $input)
|
private function getMinimumStability(InputInterface $input)
|
||||||
{
|
{
|
||||||
if ($input->hasOption('stability')) {
|
if ($input->hasOption('stability')) {
|
||||||
return $input->getOption('stability') ?: 'stable';
|
return VersionParser::normalizeStability($input->getOption('stability') ?: 'stable');
|
||||||
}
|
}
|
||||||
|
|
||||||
$file = Factory::getComposerFile();
|
$file = Factory::getComposerFile();
|
||||||
if (is_file($file) && is_readable($file) && is_array($composer = json_decode(file_get_contents($file), true))) {
|
if (is_file($file) && is_readable($file) && is_array($composer = json_decode(file_get_contents($file), true))) {
|
||||||
if (!empty($composer['minimum-stability'])) {
|
if (!empty($composer['minimum-stability'])) {
|
||||||
return $composer['minimum-stability'];
|
return VersionParser::normalizeStability($composer['minimum-stability']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue