1
0
Fork 0

Fix regression in 036fc44c25, fixes #7268

pull/7289/merge
Jordi Boggiano 2018-05-03 17:30:19 +02:00
parent 69d25c090e
commit 43e33be79f
3 changed files with 7 additions and 9 deletions

View File

@ -17,6 +17,7 @@ use Composer\DependencyResolver\DefaultPolicy;
use Composer\DependencyResolver\Operation\UpdateOperation;
use Composer\DependencyResolver\Operation\InstallOperation;
use Composer\DependencyResolver\Operation\UninstallOperation;
use Composer\DependencyResolver\Operation\MarkAliasUninstalledOperation;
use Composer\DependencyResolver\Operation\OperationInterface;
use Composer\DependencyResolver\PolicyInterface;
use Composer\DependencyResolver\Pool;
@ -716,6 +717,10 @@ class Installer
foreach ($devPackages as $pkg) {
$packagesToSkip[$pkg->getName()] = true;
if ($installedDevPkg = $localRepo->findPackage($pkg->getName(), '*')) {
if ($installedDevPkg instanceof AliasPackage) {
$finalOps[] = new MarkAliasUninstalledOperation($installedDevPkg, 'non-dev install removing it');
$installedDevPkg = $installedDevPkg->getAliasOf();
}
$finalOps[] = new UninstallOperation($installedDevPkg, 'non-dev install removing it');
}
}

View File

@ -167,13 +167,6 @@ class ArrayRepository extends BaseRepository
{
$packageId = $package->getUniqueName();
if ($package instanceof AliasPackage) {
$aliasedPackage = $package->getAliasOf();
if ($this === $aliasedPackage->getRepository()) {
$this->removePackage($aliasedPackage);
}
}
foreach ($this->getPackages() as $key => $repoPackage) {
if ($packageId === $repoPackage->getUniqueName()) {
array_splice($this->packages, $key, 1);

View File

@ -68,7 +68,7 @@ class ArrayRepositoryTest extends TestCase
$this->assertEquals('bar', $bar[0]->getName());
}
public function testAutomaticallyAddAndRemoveAliasedPackage()
public function testAutomaticallyAddAliasedPackageButNotRemove()
{
$repo = new ArrayRepository();
@ -83,7 +83,7 @@ class ArrayRepositoryTest extends TestCase
$repo->removePackage($alias);
$this->assertCount(0, $repo);
$this->assertCount(1, $repo);
}
public function testSearch()