mirror of
https://github.com/composer/composer
synced 2025-05-10 00:53:06 +00:00
[#2492] Prefixed real versions with ~ when guessing the latest version
2.1.0 > ~2.1.0 v2.1.0 -> ~2.1.0 dev-master -> dev-master
This commit is contained in:
parent
58535a62fa
commit
26179cc4b4
1 changed files with 11 additions and 1 deletions
|
@ -349,7 +349,17 @@ EOT
|
|||
));
|
||||
}
|
||||
|
||||
$requirement['version'] = $package->getPrettyVersion();
|
||||
$version = $package->getPrettyVersion();
|
||||
if (!$package->isDev()) {
|
||||
// remove the v prefix if there is one
|
||||
if (substr($version, 0, 1) == 'v') {
|
||||
$version = substr($version, 1);
|
||||
}
|
||||
|
||||
// 2.1.0 -> ~2.1.0, 2.0-beta.1 -> ~2.0-beta.1
|
||||
$version = '~'.$version;
|
||||
}
|
||||
$requirement['version'] = $version;
|
||||
|
||||
$output->writeln(sprintf(
|
||||
'Using version <info>%s</info> for <info>%s</info>',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue