mirror of
https://github.com/composer/composer
synced 2025-05-10 17:12:51 +00:00
Give a clearer error message explaining how to update a conflicting locked dependency
This commit is contained in:
parent
1b55b466fb
commit
9858718ef6
5 changed files with 80 additions and 3 deletions
|
@ -36,12 +36,15 @@ class SolverProblemsException extends \RuntimeException
|
|||
$installedMap = $request->getPresentMap(true);
|
||||
$text = "\n";
|
||||
$hasExtensionProblems = false;
|
||||
$isCausedByLock = false;
|
||||
foreach ($this->problems as $i => $problem) {
|
||||
$text .= " Problem ".($i + 1).$problem->getPrettyString($repositorySet, $request, $pool, $installedMap, $this->learnedPool)."\n";
|
||||
|
||||
if (!$hasExtensionProblems && $this->hasExtensionProblems($problem->getReasons())) {
|
||||
$hasExtensionProblems = true;
|
||||
}
|
||||
|
||||
$isCausedByLock |= $problem->isCausedByLock();
|
||||
}
|
||||
|
||||
if (!$isDevExtraction && (strpos($text, 'could not be found') || strpos($text, 'no matching package found'))) {
|
||||
|
@ -52,6 +55,10 @@ class SolverProblemsException extends \RuntimeException
|
|||
$text .= $this->createExtensionHint();
|
||||
}
|
||||
|
||||
if ($isCausedByLock && !$isDevExtraction) {
|
||||
$text .= "\nUse the option --with-all-dependencies to allow updates and removals for packages currently locked to specific versions.";
|
||||
}
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue