From c06edd61e4f6e2e93273809a7da32d12922b3b71 Mon Sep 17 00:00:00 2001 From: Dennis Birkholz Date: Tue, 15 Sep 2015 18:28:17 +0200 Subject: [PATCH] Fail if no repository was found --- src/Composer/Repository/PathRepository.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Composer/Repository/PathRepository.php b/src/Composer/Repository/PathRepository.php index 94df63104..1abca00b6 100644 --- a/src/Composer/Repository/PathRepository.php +++ b/src/Composer/Repository/PathRepository.php @@ -101,12 +101,15 @@ class PathRepository extends ArrayRepository { parent::initialize(); + $foundPackage = false; + foreach ($this->getPaths() as $path) { $composerFilePath = $path.'composer.json'; if (!file_exists($composerFilePath)) { continue; } + $foundPackage = true; $json = file_get_contents($composerFilePath); $package = JsonFile::parseJson($json, $composerFilePath); $package['dist'] = array( @@ -125,6 +128,10 @@ class PathRepository extends ArrayRepository $package = $this->loader->load($package); $this->addPackage($package); } + + if (!$foundPackage) { + throw new \RuntimeException(sprintf('No `composer.json` file found in any path repository in "%s"', $this->url)); + } } /**