Make sure Request::requireName can not be called twice for the same name
parent
00e268cdbf
commit
f516d36f6f
|
@ -56,7 +56,14 @@ class Request
|
||||||
public function requireName($packageName, ConstraintInterface $constraint = null)
|
public function requireName($packageName, ConstraintInterface $constraint = null)
|
||||||
{
|
{
|
||||||
$packageName = strtolower($packageName);
|
$packageName = strtolower($packageName);
|
||||||
$this->requires[$packageName] = $constraint ? $constraint : new MatchAllConstraint();
|
|
||||||
|
if ($constraint === null) {
|
||||||
|
$constraint = new MatchAllConstraint();
|
||||||
|
}
|
||||||
|
if (isset($this->requires[$packageName])) {
|
||||||
|
throw new \LogicException('Overwriting requires seems like a bug ('.$packageName.' '.$this->requires[$packageName]->getPrettyConstraint().' => '.$constraint->getPrettyConstraint().', check why it is happening, might be a root alias');
|
||||||
|
}
|
||||||
|
$this->requires[$packageName] = $constraint;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue