1
0
Fork 0
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:
Ryan Weaver 2014-09-12 11:23:20 -04:00
parent aea2e901a9
commit 895e62e859
3 changed files with 87 additions and 12 deletions

View file

@ -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);
}
}