Report typos in package name if no version matches
parent
104e048c07
commit
5d78fa6ce6
|
@ -33,6 +33,13 @@ class Problem
|
|||
|
||||
protected $section = 0;
|
||||
|
||||
protected $pool;
|
||||
|
||||
public function __construct(Pool $pool)
|
||||
{
|
||||
$this->pool = $pool;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a rule as a reason
|
||||
*
|
||||
|
@ -88,6 +95,10 @@ class Problem
|
|||
return "\n - The requested linked library ".$job['packageName'].$this->constraintToText($job['constraint']).' has the wrong version installed or is missing from your system, make sure to have the extension providing it.';
|
||||
}
|
||||
|
||||
if (!$this->pool->whatProvides($job['packageName'])) {
|
||||
return "\n - The requested package ".$job['packageName'].' could not be found in any version, you most likely did a typo in the package name.';
|
||||
}
|
||||
|
||||
return "\n - The requested package ".$job['packageName'].$this->constraintToText($job['constraint']).' could not be found.';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ class Solver
|
|||
|
||||
if ($conflict && RuleSet::TYPE_PACKAGE === $conflict->getType()) {
|
||||
|
||||
$problem = new Problem;
|
||||
$problem = new Problem($this->pool);
|
||||
|
||||
$problem->addRule($rule);
|
||||
$problem->addRule($conflict);
|
||||
|
@ -93,7 +93,7 @@ class Solver
|
|||
}
|
||||
|
||||
// conflict with another job
|
||||
$problem = new Problem;
|
||||
$problem = new Problem($this->pool);
|
||||
$problem->addRule($rule);
|
||||
$problem->addRule($conflict);
|
||||
|
||||
|
@ -146,7 +146,7 @@ class Solver
|
|||
|
||||
case 'install':
|
||||
if (!$job['packages']) {
|
||||
$problem = new Problem();
|
||||
$problem = new Problem($this->pool);
|
||||
$problem->addRule(new Rule($this->pool, array(), null, null, $job));
|
||||
$this->problems[] = $problem;
|
||||
}
|
||||
|
@ -465,7 +465,7 @@ class Solver
|
|||
|
||||
private function analyzeUnsolvable($conflictRule, $disableRules)
|
||||
{
|
||||
$problem = new Problem;
|
||||
$problem = new Problem($this->pool);
|
||||
$problem->addRule($conflictRule);
|
||||
|
||||
$this->analyzeUnsolvableRule($problem, $conflictRule);
|
||||
|
|
|
@ -75,7 +75,7 @@ class SolverTest extends TestCase
|
|||
} catch (SolverProblemsException $e) {
|
||||
$problems = $e->getProblems();
|
||||
$this->assertEquals(1, count($problems));
|
||||
$this->assertEquals("\n - The requested package b == 1 could not be found.", $problems[0]->getPrettyString());
|
||||
$this->assertEquals("\n - The requested package b could not be found in any version, you most likely did a typo in the package name.", $problems[0]->getPrettyString());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue