1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-10 09:02:59 +00:00

Take php version into account for create-project command version selection

This commit is contained in:
Jordi Boggiano 2015-10-29 22:35:01 +00:00
parent c7ed232ef4
commit ef2856ef55

View file

@ -276,9 +276,12 @@ EOT
$pool = new Pool($stability);
$pool->addRepository($sourceRepo);
// using those 3 constants to build a version without the 'extra' bit that can contain garbage
$phpVersion = PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION.'.'.PHP_RELEASE_VERSION;
// find the latest version if there are multiple
$versionSelector = new VersionSelector($pool);
$package = $versionSelector->findBestCandidate($name, $packageVersion);
$package = $versionSelector->findBestCandidate($name, $packageVersion, $phpVersion);
if (!$package) {
throw new \InvalidArgumentException("Could not find package $name" . ($packageVersion ? " with version $packageVersion." : " with stability $stability."));