1
0
Fork 0

Improved error message when adding a package that is disallowed by PHP version, fixes #4686

pull/5025/head
Niels Keurentjes 2016-03-08 23:09:08 +01:00
parent fe134d3359
commit fbbde23fb3
1 changed files with 6 additions and 0 deletions

View File

@ -633,6 +633,12 @@ EOT
$package = $versionSelector->findBestCandidate($name, null, $phpVersion); $package = $versionSelector->findBestCandidate($name, null, $phpVersion);
if (!$package) { if (!$package) {
// Check whether the PHP version was the problem
if ($phpVersion && $versionSelector->findBestCandidate($name)) {
throw new \InvalidArgumentException(sprintf(
'Could not find package %s at any version matching your PHP version %s', $name, $phpVersion
));
}
throw new \InvalidArgumentException(sprintf( throw new \InvalidArgumentException(sprintf(
'Could not find package %s at any version for your minimum-stability (%s). Check the package spelling or your minimum-stability', 'Could not find package %s at any version for your minimum-stability (%s). Check the package spelling or your minimum-stability',
$name, $name,