From 7d7e3d594befc601797d4a986c4a88e600868092 Mon Sep 17 00:00:00 2001 From: Patrick Weyck Date: Tue, 14 Jan 2020 15:39:11 +0100 Subject: [PATCH] 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. --- src/Composer/Command/InitCommand.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Composer/Command/InitCommand.php b/src/Composer/Command/InitCommand.php index 440187ae8..d234a8cba 100644 --- a/src/Composer/Command/InitCommand.php +++ b/src/Composer/Command/InitCommand.php @@ -16,6 +16,7 @@ use Composer\DependencyResolver\Pool; use Composer\Factory; use Composer\Json\JsonFile; use Composer\Package\BasePackage; +use Composer\Package\Package; use Composer\Package\Version\VersionParser; use Composer\Package\Version\VersionSelector; use Composer\Repository\CompositeRepository; @@ -702,13 +703,13 @@ EOT private function getMinimumStability(InputInterface $input) { if ($input->hasOption('stability')) { - return $input->getOption('stability') ?: 'stable'; + return VersionParser::normalizeStability($input->getOption('stability') ?: 'stable'); } $file = Factory::getComposerFile(); if (is_file($file) && is_readable($file) && is_array($composer = json_decode(file_get_contents($file), true))) { if (!empty($composer['minimum-stability'])) { - return $composer['minimum-stability']; + return VersionParser::normalizeStability($composer['minimum-stability']); } }