mirror of
https://github.com/composer/composer
synced 2025-05-11 01:22:54 +00:00
Added support for the alias of an aliased package
This commit is contained in:
parent
c39e958a6f
commit
753a8345cb
14 changed files with 120 additions and 119 deletions
|
@ -124,18 +124,17 @@ class ArrayRepository implements RepositoryInterface
|
|||
$package->setRepository($this);
|
||||
$this->packages[] = $package;
|
||||
|
||||
// create alias package on the fly if needed
|
||||
if ($package->getAlias()) {
|
||||
$alias = $this->createAliasPackage($package);
|
||||
if (!$this->hasPackage($alias)) {
|
||||
$this->addPackage($alias);
|
||||
if ($package instanceof AliasPackage) {
|
||||
$aliasedPackage = $package->getAliasOf();
|
||||
if (null === $aliasedPackage->getRepository()) {
|
||||
$this->addPackage($aliasedPackage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function createAliasPackage(PackageInterface $package, $alias = null, $prettyAlias = null)
|
||||
protected function createAliasPackage(PackageInterface $package, $alias, $prettyAlias)
|
||||
{
|
||||
return new AliasPackage($package, $alias ?: $package->getAlias(), $prettyAlias ?: $package->getPrettyAlias());
|
||||
return new AliasPackage($package instanceof AliasPackage ? $package->getAliasOf() : $package, $alias, $prettyAlias);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue