1
0
Fork 0

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
pull/10687/head
David Zülke 2022-04-01 09:46:12 +02:00 committed by GitHub
parent 29513c15da
commit 03b7882ac2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 8 deletions

View File

@ -557,17 +557,18 @@ class Application extends BaseApplication
public function getLongVersion(): string public function getLongVersion(): string
{ {
$branchAliasString = '';
if (Composer::BRANCH_ALIAS_VERSION && Composer::BRANCH_ALIAS_VERSION !== '@package_branch_alias_version'.'@') { if (Composer::BRANCH_ALIAS_VERSION && Composer::BRANCH_ALIAS_VERSION !== '@package_branch_alias_version'.'@') {
return sprintf( $branchAliasString = sprintf(' (%s)', Composer::BRANCH_ALIAS_VERSION);
'<info>%s</info> version <comment>%s (%s)</comment> %s',
$this->getName(),
Composer::BRANCH_ALIAS_VERSION,
$this->getVersion(),
Composer::RELEASE_DATE
);
} }
return parent::getLongVersion() . ' ' . Composer::RELEASE_DATE; return sprintf(
'<info>%s</info> version <comment>%s%s</comment> %s',
$this->getName(),
$this->getVersion(),
$branchAliasString,
Composer::RELEASE_DATE
);
} }
protected function getDefaultInputDefinition(): InputDefinition protected function getDefaultInputDefinition(): InputDefinition