1
0
Fork 0

Avoid rendering problem output for dev-master aliases which is useless

pull/8937/head
Jordi Boggiano 2020-06-02 13:13:11 +02:00
parent 1ea3111583
commit 8a7f3a9a09
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
2 changed files with 10 additions and 3 deletions

View File

@ -104,7 +104,7 @@ class Problem
$template = preg_replace('{^\S+ \S+ }', '%s%s ', $message);
$messages[] = $template;
$templates[$template][$m[1]][$parser->normalize($m[2])] = $m[2];
} else {
} elseif ($message !== '') {
$messages[] = $message;
}
}

View File

@ -275,7 +275,10 @@ abstract class Rule
$learnedString = ', learned rules:'."\n - ";
$reasons = array();
foreach ($learnedPool[$this->reasonData] as $learnedRule) {
$reasons[] = $learnedRule->getPrettyString($repositorySet, $request, $pool, $installedMap, $learnedPool);
$reason = $learnedRule->getPrettyString($repositorySet, $request, $pool, $installedMap, $learnedPool);
if ($reason !== '') {
$reasons[] = $reason;
}
}
$learnedString .= implode("\n - ", array_unique($reasons));
} else {
@ -284,7 +287,11 @@ abstract class Rule
return 'Conclusion: '.$ruleText.$learnedString;
case self::RULE_PACKAGE_ALIAS:
$aliasPackage = $this->deduplicateMasterAlias($pool->literalToPackage($literals[0]));
$aliasPackage = $pool->literalToPackage($literals[0]);
// avoid returning content like "9999999-dev is an alias of dev-master" as it is useless
if ($aliasPackage->getVersion() === VersionParser::DEV_MASTER_ALIAS) {
return '';
}
$package = $this->deduplicateMasterAlias($pool->literalToPackage($literals[1]));
return $aliasPackage->getPrettyString() .' is an alias of '.$package->getPrettyString().' and thus requires it to be installed too.';