From 61f54e19ced1fc479dad365f65bffbc3d4d38c03 Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Wed, 25 Apr 2018 20:36:43 +0200 Subject: [PATCH 1/2] Fix the JSON schema for package repositories --- res/composer-schema.json | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/res/composer-schema.json b/res/composer-schema.json index 3a4f2d1d0..77721edda 100644 --- a/res/composer-schema.json +++ b/res/composer-schema.json @@ -678,9 +678,7 @@ { "$ref": "#/definitions/inline-package" }, { "type": "array", - "items": { - "type": { "$ref": "#/definitions/inline-package" } - } + "items": { "$ref": "#/definitions/inline-package" } } ] } From 43e33be79f5c883fb50aef17689aba6685c747bb Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Thu, 3 May 2018 17:30:19 +0200 Subject: [PATCH 2/2] Fix regression in 036fc44c25e051479f06435800d76c4301d9b1fa, fixes #7268 --- src/Composer/Installer.php | 5 +++++ src/Composer/Repository/ArrayRepository.php | 7 ------- tests/Composer/Test/Repository/ArrayRepositoryTest.php | 4 ++-- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/Composer/Installer.php b/src/Composer/Installer.php index 0d842bb53..c60b707d6 100644 --- a/src/Composer/Installer.php +++ b/src/Composer/Installer.php @@ -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'); } } diff --git a/src/Composer/Repository/ArrayRepository.php b/src/Composer/Repository/ArrayRepository.php index 7a4251084..4f0409a60 100644 --- a/src/Composer/Repository/ArrayRepository.php +++ b/src/Composer/Repository/ArrayRepository.php @@ -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); diff --git a/tests/Composer/Test/Repository/ArrayRepositoryTest.php b/tests/Composer/Test/Repository/ArrayRepositoryTest.php index 5927325ee..bd19b979c 100644 --- a/tests/Composer/Test/Repository/ArrayRepositoryTest.php +++ b/tests/Composer/Test/Repository/ArrayRepositoryTest.php @@ -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()