Fix SpecificConstraint which only handles matching of instances of same constraint
parent
d5dd86cd75
commit
9b8ab7d710
|
@ -17,21 +17,21 @@ namespace Composer\Package\LinkConstraint;
|
||||||
*
|
*
|
||||||
* @author Nils Adermann <naderman@naderman.de>
|
* @author Nils Adermann <naderman@naderman.de>
|
||||||
*/
|
*/
|
||||||
class SpecificConstraint implements LinkConstraintInterface
|
abstract class SpecificConstraint implements LinkConstraintInterface
|
||||||
{
|
{
|
||||||
public function matches(LinkConstraintInterface $provider)
|
public function matches(LinkConstraintInterface $provider)
|
||||||
{
|
{
|
||||||
if ($provider instanceof MultiConstraint) {
|
if ($provider instanceof MultiConstraint) {
|
||||||
// turn matching around to find a match
|
// turn matching around to find a match
|
||||||
return $provider->matches($this);
|
return $provider->matches($this);
|
||||||
} else if ($provider instanceof get_class($this)) {
|
} else if ($provider instanceof $this) {
|
||||||
return $this->matchSpecific($provider);
|
return $this->matchSpecific($provider);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract public function matchSpecific($provider);
|
// implementations must implement a method of this format:
|
||||||
|
// not declared abstract here because type hinting violates parameter coherence (TODO right word?)
|
||||||
abstract public function __toString();
|
// public function matchSpecific(<SpecificConstraintType> $provider);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue