From a9c6bb7589ff378890842fef3b3c40b406eaac62 Mon Sep 17 00:00:00 2001 From: Bauke van der Woude <6784391+baukevdw@users.noreply.github.com> Date: Tue, 26 Jul 2022 12:36:03 +0200 Subject: [PATCH 1/3] Fix LogicException for composer ^2.3 Fixes #115 --- src/Composer/StudioPlugin.php | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/Composer/StudioPlugin.php b/src/Composer/StudioPlugin.php index 1730db1..1db34ae 100644 --- a/src/Composer/StudioPlugin.php +++ b/src/Composer/StudioPlugin.php @@ -58,11 +58,23 @@ public function registerStudioPackages() foreach ($this->getManagedPaths() as $path) { $this->io->writeError("[Studio] Loading path $path"); - $repoManager->prependRepository(new PathRepository( - ['url' => $path], - $this->io, - $composerConfig - )); + // In case composer version >= 2.3.0 + if (method_exists($this->composer, 'getLoop')) { + $repoManager->prependRepository(new PathRepository( + ['url' => $path], + $this->io, + $composerConfig, + $this->composer->getLoop()->getHttpDownloader(), + $this->composer->getEventDispatcher(), + $this->composer->getLoop()->getProcessExecutor() + )); + } else { + $repoManager->prependRepository(new PathRepository( + ['url' => $path], + $this->io, + $composerConfig + )); + } } } From a9f2f34135383c010f2ad714bfcdbea6bccd927b Mon Sep 17 00:00:00 2001 From: Jannik Zschiesche Date: Wed, 12 Oct 2022 12:13:31 +0200 Subject: [PATCH 2/3] Extend comment about loop integration --- src/Composer/StudioPlugin.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Composer/StudioPlugin.php b/src/Composer/StudioPlugin.php index 1db34ae..a9f3ddc 100644 --- a/src/Composer/StudioPlugin.php +++ b/src/Composer/StudioPlugin.php @@ -58,7 +58,8 @@ public function registerStudioPackages() foreach ($this->getManagedPaths() as $path) { $this->io->writeError("[Studio] Loading path $path"); - // In case composer version >= 2.3.0 + // Composer v2 always exposes the internal loop, so keep reusing it + // that is a fixed requirement since Composer >= 2.3 if (method_exists($this->composer, 'getLoop')) { $repoManager->prependRepository(new PathRepository( ['url' => $path], From 735e94f59e17ecac3cd86ac916a44ec90ef031d0 Mon Sep 17 00:00:00 2001 From: Jannik Zschiesche Date: Wed, 12 Oct 2022 12:13:41 +0200 Subject: [PATCH 3/3] Use Composer v2 when developing --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 0c531ee..3ac6eab 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ "symfony/process": "^2.5 || ^3.0 || ^4.0 || ^5.0 || ^6.0" }, "require-dev": { - "composer/composer": "1.10.x-dev", + "composer/composer": "^2.4.2", "phpspec/phpspec": "^6.3 || ^7.0" }, "replace": {