Skip to content

Commit

Permalink
Merge pull request #116 from baukevdw/baukevdw-patch-1
Browse files Browse the repository at this point in the history
Fix LogicException for composer ^2.3
  • Loading branch information
apfelbox authored Oct 12, 2022
2 parents 1dafb62 + 85b440f commit 1255eb4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
23 changes: 18 additions & 5 deletions src/Composer/StudioPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
));
}
}
}

Expand Down

0 comments on commit 1255eb4

Please sign in to comment.