Skip to content

Commit

Permalink
restore --version output to pre-2.3 (#10684)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dzuelke committed Apr 1, 2022
1 parent 29513c1 commit 03b7882
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/Composer/Console/Application.php
Expand Up @@ -557,17 +557,18 @@ protected function getDefaultCommands(): array

public function getLongVersion(): string
{
$branchAliasString = '';
if (Composer::BRANCH_ALIAS_VERSION && Composer::BRANCH_ALIAS_VERSION !== '@package_branch_alias_version'.'@') {
return sprintf(
'<info>%s</info> version <comment>%s (%s)</comment> %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(
'<info>%s</info> version <comment>%s%s</comment> %s',
$this->getName(),
$this->getVersion(),
$branchAliasString,
Composer::RELEASE_DATE
);
}

protected function getDefaultInputDefinition(): InputDefinition
Expand Down

0 comments on commit 03b7882

Please sign in to comment.