Эх сурвалжийг харах

Fix constant usage to be compatible with PHP 5.3

Raphaël Aurières 6 жил өмнө
parent
commit
a8f27bf097

+ 6 - 2
src/Composer/Json/JsonFile.php

@@ -34,7 +34,7 @@ class JsonFile
     const JSON_PRETTY_PRINT = 128;
     const JSON_PRETTY_PRINT = 128;
     const JSON_UNESCAPED_UNICODE = 256;
     const JSON_UNESCAPED_UNICODE = 256;
 
 
-    const COMPOSER_SCHEMA_PATH = __DIR__ . '/../../../res/composer-schema.json';
+    const COMPOSER_SCHEMA_PATH = '/../../../res/composer-schema.json';
 
 
     private $path;
     private $path;
     private $rfs;
     private $rfs;
@@ -150,7 +150,7 @@ class JsonFile
      * @throws JsonValidationException
      * @throws JsonValidationException
      * @return bool                    true on success
      * @return bool                    true on success
      */
      */
-    public function validateSchema($schema = self::STRICT_SCHEMA, $schemaFile = self::COMPOSER_SCHEMA_PATH)
+    public function validateSchema($schema = self::STRICT_SCHEMA, $schemaFile = null)
     {
     {
         $content = file_get_contents($this->path);
         $content = file_get_contents($this->path);
         $data = json_decode($content);
         $data = json_decode($content);
@@ -159,6 +159,10 @@ class JsonFile
             self::validateSyntax($content, $this->path);
             self::validateSyntax($content, $this->path);
         }
         }
 
 
+        if (null === $schemaFile) {
+            $schemaFile = __DIR__ . self::COMPOSER_SCHEMA_PATH;
+        }
+
         // Prepend with file:// only when not using a special schema already (e.g. in the phar)
         // Prepend with file:// only when not using a special schema already (e.g. in the phar)
         if (false === strpos($schemaFile, '://')) {
         if (false === strpos($schemaFile, '://')) {
             $schemaFile = 'file://' . $schemaFile;
             $schemaFile = 'file://' . $schemaFile;