mirror of
https://github.com/composer/composer
synced 2025-05-10 09:02:59 +00:00
Make problem report messages more readable
Added pretty strings to constraints
This commit is contained in:
parent
4bbb168d44
commit
cc7632489d
14 changed files with 187 additions and 40 deletions
|
@ -18,23 +18,24 @@ namespace Composer\DependencyResolver;
|
|||
class SolverProblemsException extends \RuntimeException
|
||||
{
|
||||
protected $problems;
|
||||
protected $installedMap;
|
||||
|
||||
public function __construct(array $problems)
|
||||
public function __construct(array $problems, array $installedMap)
|
||||
{
|
||||
$this->problems = $problems;
|
||||
$this->installedMap = $installedMap;
|
||||
|
||||
parent::__construct($this->createMessage());
|
||||
}
|
||||
|
||||
protected function createMessage()
|
||||
{
|
||||
$messages = array();
|
||||
|
||||
foreach ($this->problems as $problem) {
|
||||
$messages[] = (string) $problem;
|
||||
$text = "\n";
|
||||
foreach ($this->problems as $i => $problem) {
|
||||
$text .= " Problem ".($i+1).$problem->getPrettyString($this->installedMap)."\n";
|
||||
}
|
||||
|
||||
return "\n\tProblems:\n\t\t- ".implode("\n\t\t- ", $messages);
|
||||
return $text;
|
||||
}
|
||||
|
||||
public function getProblems()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue