Parcourir la source

Allow JsonLoader to load by file name

Jordi Boggiano il y a 13 ans
Parent
commit
f572bbb0bf
1 fichiers modifiés avec 2 ajouts et 0 suppressions
  1. 2 0
      src/Composer/Package/Loader/JsonLoader.php

+ 2 - 0
src/Composer/Package/Loader/JsonLoader.php

@@ -23,6 +23,8 @@ class JsonLoader extends ArrayLoader
     {
         if ($json instanceof JsonFile) {
             $config = $json->read();
+        } elseif (file_exists($json)) {
+            $config = JsonFile::parseJson(file_get_contents($json));
         } elseif (is_string($json)) {
             $config = JsonFile::parseJson($json);
         }