From 03b7882ac231d19e9373ed33a8e71d7bb5b280c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Z=C3=BClke?= Date: Fri, 1 Apr 2022 09:46:12 +0200 Subject: [PATCH] restore --version output to pre-2.3 (#10684) Symfony Console 2.8 used to print 'version ' in between name and version, and Composer 2.3 still does for -dev snapshots, so we're going back to the old formatting for consistency (and anyone out there who parses the version output of Composer) Fixes #10683 --- src/Composer/Console/Application.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/Composer/Console/Application.php b/src/Composer/Console/Application.php index 5768ff8f4..5b03b8faf 100644 --- a/src/Composer/Console/Application.php +++ b/src/Composer/Console/Application.php @@ -557,17 +557,18 @@ class Application extends BaseApplication public function getLongVersion(): string { + $branchAliasString = ''; if (Composer::BRANCH_ALIAS_VERSION && Composer::BRANCH_ALIAS_VERSION !== '@package_branch_alias_version'.'@') { - return sprintf( - '%s version %s (%s) %s', - $this->getName(), - Composer::BRANCH_ALIAS_VERSION, - $this->getVersion(), - Composer::RELEASE_DATE - ); + $branchAliasString = sprintf(' (%s)', Composer::BRANCH_ALIAS_VERSION); } - return parent::getLongVersion() . ' ' . Composer::RELEASE_DATE; + return sprintf( + '%s version %s%s %s', + $this->getName(), + $this->getVersion(), + $branchAliasString, + Composer::RELEASE_DATE + ); } protected function getDefaultInputDefinition(): InputDefinition