mirror of
https://github.com/composer/composer
synced 2025-05-11 01:22:54 +00:00
Deduplicate solver problems which list problems for dev-master AND 9999999-dev
This commit is contained in:
parent
ce8e9d24bd
commit
8945936dbd
5 changed files with 136 additions and 8 deletions
|
@ -34,11 +34,12 @@ class SolverProblemsException extends \RuntimeException
|
|||
public function getPrettyString(RepositorySet $repositorySet, Request $request, Pool $pool, $isDevExtraction = false)
|
||||
{
|
||||
$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";
|
||||
|
||||
$problems = array();
|
||||
foreach ($this->problems as $problem) {
|
||||
$problems[] = $problem->getPrettyString($repositorySet, $request, $pool, $installedMap, $this->learnedPool)."\n";
|
||||
|
||||
if (!$hasExtensionProblems && $this->hasExtensionProblems($problem->getReasons())) {
|
||||
$hasExtensionProblems = true;
|
||||
|
@ -47,6 +48,12 @@ class SolverProblemsException extends \RuntimeException
|
|||
$isCausedByLock |= $problem->isCausedByLock();
|
||||
}
|
||||
|
||||
$i = 1;
|
||||
$text = "\n";
|
||||
foreach (array_unique($problems) as $problem) {
|
||||
$text .= " Problem ".($i++).$problem;
|
||||
}
|
||||
|
||||
if (!$isDevExtraction && (strpos($text, 'could not be found') || strpos($text, 'no matching package found'))) {
|
||||
$text .= "\nPotential causes:\n - A typo in the package name\n - The package is not available in a stable-enough version according to your minimum-stability setting\n see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.\n - It's a private package and you forgot to add a custom repository to find it\n\nRead <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.";
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue