Fix more issues with dev-master normalization in aliases
parent
e09dd9c10d
commit
7cca451312
|
@ -173,19 +173,27 @@ class AliasPackage extends BasePackage implements CompletePackageInterface
|
|||
*/
|
||||
protected function replaceSelfVersionDependencies(array $links, $linkType)
|
||||
{
|
||||
// for self.version requirements, we use the original package's branch name instead of 9999999-dev, to avoid leaking 9999999-dev to users
|
||||
$prettyVersion = $this->prettyVersion;
|
||||
if ($prettyVersion === '9999999-dev') {
|
||||
$prettyVersion = $this->aliasOf->getPrettyVersion();
|
||||
}
|
||||
|
||||
if (in_array($linkType, array('conflicts', 'provides', 'replaces'), true)) {
|
||||
$newLinks = array();
|
||||
foreach ($links as $link) {
|
||||
// link is self.version, but must be replacing also the replaced version
|
||||
if ('self.version' === $link->getPrettyConstraint()) {
|
||||
$newLinks[] = new Link($link->getSource(), $link->getTarget(), new Constraint('=', $this->version), $linkType, $this->prettyVersion);
|
||||
$newLinks[] = new Link($link->getSource(), $link->getTarget(), $constraint = new Constraint('=', $this->version), $linkType, $prettyVersion);
|
||||
$constraint->setPrettyString($prettyVersion);
|
||||
}
|
||||
}
|
||||
$links = array_merge($links, $newLinks);
|
||||
} else {
|
||||
foreach ($links as $index => $link) {
|
||||
if ('self.version' === $link->getPrettyConstraint()) {
|
||||
$links[$index] = new Link($link->getSource(), $link->getTarget(), new Constraint('=', $this->version), $linkType, $this->prettyVersion);
|
||||
$links[$index] = new Link($link->getSource(), $link->getTarget(), $constraint = new Constraint('=', $this->version), $linkType, $prettyVersion);
|
||||
$constraint->setPrettyString($prettyVersion);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -247,11 +247,13 @@ class ArrayLoader implements LoaderInterface
|
|||
}
|
||||
|
||||
if ($aliasNormalized = $this->getBranchAlias($config)) {
|
||||
$prettyAlias = preg_replace('{(\.9{7})+}', '.x', $aliasNormalized);
|
||||
|
||||
if ($package instanceof RootPackageInterface) {
|
||||
return new RootAliasPackage($package, $aliasNormalized, preg_replace('{(\.9{7})+}', '.x', $aliasNormalized));
|
||||
return new RootAliasPackage($package, $aliasNormalized, $prettyAlias);
|
||||
}
|
||||
|
||||
return new AliasPackage($package, $aliasNormalized, preg_replace('{(\.9{7})+}', '.x', $aliasNormalized));
|
||||
return new AliasPackage($package, $aliasNormalized, $prettyAlias);
|
||||
}
|
||||
|
||||
return $package;
|
||||
|
|
Loading…
Reference in New Issue