1
0
Fork 0

Merge pull request #8534 from pweyck/normalize-rc-to-RC-in-init

Normalize minimum-stability `rc` to `RC` in `InitCommand`
pull/8529/head
Jordi Boggiano 2020-01-18 13:54:01 +01:00 committed by GitHub
commit 88cff792cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -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']);
} }
} }