From e68b52697b73630df03a4e7706fc6e01f00d2120 Mon Sep 17 00:00:00 2001
From: TerryKern <56536101+terrykern@users.noreply.github.com>
Date: Tue, 20 Oct 2020 11:48:51 +0200
Subject: [PATCH] Improve readability of version info message
Instead of:
> You are already using composer version 1.10.15 (1 channel).
it shows:
> You are already using composer version 1.10.15 (1.x channel).
---
src/Composer/Command/SelfUpdateCommand.php | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/Composer/Command/SelfUpdateCommand.php b/src/Composer/Command/SelfUpdateCommand.php
index 348451e76..4802afcd1 100644
--- a/src/Composer/Command/SelfUpdateCommand.php
+++ b/src/Composer/Command/SelfUpdateCommand.php
@@ -177,7 +177,17 @@ EOT
}
if (Composer::VERSION === $updateVersion) {
- $io->writeError(sprintf('You are already using composer version %s (%s channel).', $updateVersion, $versionsUtil->getChannel()));
+ $channelString = $versionsUtil->getChannel();
+ if (is_numeric($channelString)) {
+ $channelString .= '.x';
+ }
+ $io->writeError(
+ sprintf(
+ 'You are already using composer version %s (%s channel).',
+ $updateVersion,
+ $channelString
+ )
+ );
// remove all backups except for the most recent, if any
if ($input->getOption('clean-backups')) {