From 6b1c9882dd113f630c2dcf69115e02887f5e2a27 Mon Sep 17 00:00:00 2001 From: Dennis Birkholz Date: Fri, 18 Sep 2015 17:26:31 +0200 Subject: [PATCH] Replace tracking variable with direct package count check --- src/Composer/Repository/PathRepository.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/Composer/Repository/PathRepository.php b/src/Composer/Repository/PathRepository.php index 5e4b1d931..b4b08b152 100644 --- a/src/Composer/Repository/PathRepository.php +++ b/src/Composer/Repository/PathRepository.php @@ -101,8 +101,6 @@ class PathRepository extends ArrayRepository { parent::initialize(); - $foundPackage = false; - foreach ($this->getPaths() as $path) { $path = realpath($path) . '/'; @@ -111,7 +109,6 @@ class PathRepository extends ArrayRepository continue; } - $foundPackage = true; $json = file_get_contents($composerFilePath); $package = JsonFile::parseJson($json, $composerFilePath); $package['dist'] = array( @@ -131,7 +128,7 @@ class PathRepository extends ArrayRepository $this->addPackage($package); } - if (!$foundPackage) { + if (count($this) == 0) { throw new \RuntimeException(sprintf('No `composer.json` file found in any path repository in "%s"', $this->url)); } }