1
0
Fork 0

Make sure root aliases are marked as such also when loaded from lock file

pull/9469/head
Jordi Boggiano 2020-11-12 17:06:33 +01:00
parent e1ead6027f
commit 6ace5bb651
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
2 changed files with 4 additions and 2 deletions

View File

@ -431,7 +431,7 @@ class AliasPackage extends BasePackage implements CompletePackageInterface
public function __toString() public function __toString()
{ {
return parent::__toString().' (alias of '.$this->aliasOf->getVersion().')'; return parent::__toString().' ('.($this->rootPackageAlias ? 'root ':''). 'alias of '.$this->aliasOf->getVersion().')';
} }
public function setDistUrl($url) public function setDistUrl($url)

View File

@ -187,7 +187,9 @@ class Locker
if (isset($lockData['aliases'])) { if (isset($lockData['aliases'])) {
foreach ($lockData['aliases'] as $alias) { foreach ($lockData['aliases'] as $alias) {
if (isset($packageByName[$alias['package']])) { if (isset($packageByName[$alias['package']])) {
$packages->addPackage(new AliasPackage($packageByName[$alias['package']], $alias['alias_normalized'], $alias['alias'])); $aliasPkg = new AliasPackage($packageByName[$alias['package']], $alias['alias_normalized'], $alias['alias']);
$aliasPkg->setRootPackageAlias(true);
$packages->addPackage($aliasPkg);
} }
} }
} }