diff --git a/src/Composer/ComposerOrchestrator.php b/src/Composer/ComposerOrchestrator.php index 2d298471e..d23a0c352 100644 --- a/src/Composer/ComposerOrchestrator.php +++ b/src/Composer/ComposerOrchestrator.php @@ -119,7 +119,7 @@ public function dumpAutoload( return; } - $autoloadFile = $this->retrieveAutoloadFile(); + $autoloadFile = $this->getVendorDir().'/autoload.php'; $autoloadContents = AutoloadDumper::generateAutoloadStatements( $symbolsRegistry, @@ -129,6 +129,25 @@ public function dumpAutoload( $this->fileSystem->dumpFile($autoloadFile, $autoloadContents); } + public function getVendorDir(): string + { + $vendorDirProcess = $this->processFactory->getAutoloadFileProcess(); + + $this->logger->info($vendorDirProcess->getCommandLine()); + + $vendorDirProcess->run(env: $this->processFactory->getDefaultEnvVars()); + + if (false === $vendorDirProcess->isSuccessful()) { + throw new RuntimeException( + 'Could not retrieve the vendor dir.', + 0, + new ProcessFailedException($vendorDirProcess), + ); + } + + return trim($vendorDirProcess->getOutput()); + } + private function dumpAutoloader(bool $noDev): void { $dumpAutoloadProcess = $this->processFactory->getDumpAutoloaderProcess($noDev); @@ -162,23 +181,4 @@ private function dumpAutoloader(bool $noDev): void ); } } - - private function retrieveAutoloadFile(): string - { - $vendorDirProcess = $this->processFactory->getAutoloadFileProcess(); - - $this->logger->info($vendorDirProcess->getCommandLine()); - - $vendorDirProcess->run(env: $this->processFactory->getDefaultEnvVars()); - - if (false === $vendorDirProcess->isSuccessful()) { - throw new RuntimeException( - 'Could not retrieve the vendor dir.', - 0, - new ProcessFailedException($vendorDirProcess), - ); - } - - return trim($vendorDirProcess->getOutput()).'/autoload.php'; - } }