浏览代码

Check that if the getUrlMatches method returns an empty value which means the path is incorrect

Mike van Rooyen 5 年之前
父节点
当前提交
18895064ad
共有 1 个文件被更改,包括 7 次插入1 次删除
  1. 7 1
      src/Composer/Repository/PathRepository.php

+ 7 - 1
src/Composer/Repository/PathRepository.php

@@ -125,7 +125,13 @@ class PathRepository extends ArrayRepository implements ConfigurableRepositoryIn
     {
         parent::initialize();
 
-        foreach ($this->getUrlMatches() as $url) {
+        $urlMatches = $this->getUrlMatches();
+
+        if (empty($urlMatches)) {
+            throw new \RuntimeException('The `url` supplied for the path repository does not exist');
+        }
+
+        foreach ($urlMatches as $url) {
             $path = realpath($url) . DIRECTORY_SEPARATOR;
             $composerFilePath = $path.'composer.json';