1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-10 09:02:59 +00:00

Clean up and deduplicate the output of RULE_LEARNED

This commit is contained in:
Jordi Boggiano 2020-01-30 11:37:19 +01:00
parent e6029d725a
commit 6c9d9e775c
No known key found for this signature in database
GPG key ID: 7BBD42C429EC80BC
2 changed files with 60 additions and 6 deletions

View file

@ -196,18 +196,18 @@ abstract class Rule
case self::RULE_PACKAGE_IMPLICIT_OBSOLETES:
return $ruleText;
case self::RULE_LEARNED:
// TODO not sure this is a good idea, most of these rules should be listed in the problem anyway
$learnedString = '(learned rule, ';
if (isset($learnedPool[$this->reasonData])) {
$learnedString = ', learned rules:'."\n - ";
$reasons = array();
foreach ($learnedPool[$this->reasonData] as $learnedRule) {
$learnedString .= $learnedRule->getPrettyString($repositorySet, $request, $installedMap, $learnedPool);
$reasons[] = $learnedRule->getPrettyString($repositorySet, $request, $installedMap, $learnedPool);
}
$learnedString .= implode("\n - ", array_unique($reasons));
} else {
$learnedString .= 'reasoning unavailable';
$learnedString = ' (reasoning unavailable)';
}
$learnedString .= ')';
return 'Conclusion: '.$ruleText.' '.$learnedString;
return 'Conclusion: '.$ruleText.$learnedString;
case self::RULE_PACKAGE_ALIAS:
return $ruleText;
default: