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": { diff --git a/src/Composer/StudioPlugin.php b/src/Composer/StudioPlugin.php index 50db6ba..54c7f15 100644 --- a/src/Composer/StudioPlugin.php +++ b/src/Composer/StudioPlugin.php @@ -58,11 +58,24 @@ public function registerStudioPackages() foreach ($this->getManagedPaths() as $path) { $this->io->writeError("[Studio] Loading path $path"); - $repoManager->prependRepository(new PathRepository( - ['url' => $path], - $this->io, - $composerConfig - )); + // 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], + $this->io, + $composerConfig, + $this->composer->getLoop()->getHttpDownloader(), + $this->composer->getEventDispatcher(), + $this->composer->getLoop()->getProcessExecutor() + )); + } else { + $repoManager->prependRepository(new PathRepository( + ['url' => $path], + $this->io, + $composerConfig + )); + } } }