1
0
Fork 0

Hint composer require alternatives if dep resolution fails, fixes #10136

pull/10158/head
Jordi Boggiano 2021-10-14 15:12:29 +02:00
parent 260ac0011c
commit f776f52474
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 8 additions and 0 deletions

View File

@ -387,6 +387,14 @@ EOT
$status = $install->run();
if ($status !== 0) {
if ($status === Installer::ERROR_DEPENDENCY_RESOLUTION_FAILED) {
foreach ($this->normalizeRequirements($input->getArgument('packages')) as $req) {
if (!isset($req['version'])) {
$io->writeError('You can also try re-running composer require with an explicit version constraint, e.g. "composer require '.$req['name'].':*" to figure out if any version is installable, or "composer require '.$req['name'].':^2.1" if you know which you need.');
break;
}
}
}
$this->revertComposerFile(false);
}