mirror of
https://github.com/composer/composer
synced 2025-05-10 17:12:51 +00:00
Refactoring selection of the "recommended" version (e.g ~1.2) and adding some tests
This also modifies the behavior slightly (from a recommendation by seldaek) to always propose the minor version of the recommendation (e.g. ~1.2 instead of ~1.2.1).
This commit is contained in:
parent
aea2e901a9
commit
895e62e859
3 changed files with 87 additions and 12 deletions
|
@ -557,17 +557,6 @@ EOT
|
|||
));
|
||||
}
|
||||
|
||||
$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;
|
||||
}
|
||||
|
||||
return $version;
|
||||
return $versionSelector->findRecommendedRequireVersion($package);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue