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)); + } } /**