Avoid duplicating self.version requirements
parent
8ba76fe6d2
commit
f999285926
|
@ -50,16 +50,29 @@ class AliasPackage extends BasePackage
|
||||||
$this->aliasOf = $aliasOf;
|
$this->aliasOf = $aliasOf;
|
||||||
$this->dev = 'dev-' === substr($version, 0, 4) || '-dev' === substr($version, -4);
|
$this->dev = 'dev-' === substr($version, 0, 4) || '-dev' === substr($version, -4);
|
||||||
|
|
||||||
foreach (self::$supportedLinkTypes as $type => $description) {
|
// replace self.version dependencies
|
||||||
$links = $aliasOf->{'get'.ucfirst($description)}();
|
foreach (array('requires', 'recommends', 'suggests') as $type) {
|
||||||
|
$links = $aliasOf->{'get'.ucfirst($type)}();
|
||||||
|
foreach ($links as $index => $link) {
|
||||||
|
// link is self.version, but must be replacing also the replaced version
|
||||||
|
if ('self.version' === $link->getPrettyConstraint()) {
|
||||||
|
$links[$index] = new Link($link->getSource(), $link->getTarget(), new VersionConstraint('=', $this->version), $type, $this->version);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->$type = $links;
|
||||||
|
}
|
||||||
|
|
||||||
|
// duplicate self.version provides
|
||||||
|
foreach (array('conflicts', 'provides', 'replaces') as $type) {
|
||||||
|
$links = $aliasOf->{'get'.ucfirst($type)}();
|
||||||
$newLinks = array();
|
$newLinks = array();
|
||||||
foreach ($links as $link) {
|
foreach ($links as $link) {
|
||||||
// link is self.version, but must be replacing also the replaced version
|
// link is self.version, but must be replacing also the replaced version
|
||||||
if ('self.version' === $link->getPrettyConstraint()) {
|
if ('self.version' === $link->getPrettyConstraint()) {
|
||||||
$newLinks[] = new Link($link->getSource(), $link->getTarget(), new VersionConstraint('=', $this->version), $description, $this->version);
|
$newLinks[] = new Link($link->getSource(), $link->getTarget(), new VersionConstraint('=', $this->version), $type, $this->version);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->$description = array_merge($links, $newLinks);
|
$this->$type = array_merge($links, $newLinks);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue