Reedy has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/313662

Change subject: Update justinrainbow/json-schema from v3.0.0 to v3.0.1
......................................................................

Update justinrainbow/json-schema from v3.0.0 to v3.0.1

https://github.com/justinrainbow/json-schema/compare/3.0.0...3.0.1

Change-Id: I61fda77bda1b747f81103ca0747d00f2458fe526
---
M composer.json
M composer.lock
M composer/installed.json
M justinrainbow/json-schema/composer.json
M justinrainbow/json-schema/src/JsonSchema/Constraints/Factory.php
M justinrainbow/json-schema/src/JsonSchema/Constraints/ObjectConstraint.php
6 files changed, 98 insertions(+), 91 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/vendor 
refs/changes/62/313662/1

diff --git a/composer.json b/composer.json
index 1775ccd..1a88132 100644
--- a/composer.json
+++ b/composer.json
@@ -12,7 +12,7 @@
                "composer/semver": "1.4.2",
                "cssjanus/cssjanus": "1.1.2",
                "firebase/php-jwt": "3.0.0",
-               "justinrainbow/json-schema": "3.0.0",
+               "justinrainbow/json-schema": "3.0.1",
                "liuggio/statsd-php-client": "1.0.18",
                "mediawiki/at-ease": "1.1.0",
                "monolog/monolog": "1.18.2",
diff --git a/composer.lock b/composer.lock
index 9e4d121..cac4739 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
         "Read more about it at 
https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file";,
         "This file is @generated automatically"
     ],
-    "content-hash": "62dbea389a0e8ae36e421cbbd00ae8ad",
+    "content-hash": "ef686f7105c2b8392ce0daaedab6ffc6",
     "packages": [
         {
             "name": "composer/semver",
@@ -148,16 +148,16 @@
         },
         {
             "name": "justinrainbow/json-schema",
-            "version": "3.0.0",
+            "version": "3.0.1",
             "source": {
                 "type": "git",
                 "url": "https://github.com/justinrainbow/json-schema.git";,
-                "reference": "12965831120bb18852e9865804a6089906323b8e"
+                "reference": "2128f9de8be4600c3394d94c3918faf67157b76b"
             },
             "dist": {
                 "type": "zip",
-                "url": 
"https://api.github.com/repos/justinrainbow/json-schema/zipball/12965831120bb18852e9865804a6089906323b8e";,
-                "reference": "12965831120bb18852e9865804a6089906323b8e",
+                "url": 
"https://api.github.com/repos/justinrainbow/json-schema/zipball/2128f9de8be4600c3394d94c3918faf67157b76b";,
+                "reference": "2128f9de8be4600c3394d94c3918faf67157b76b",
                 "shasum": ""
             },
             "require": {
@@ -174,7 +174,7 @@
             "type": "library",
             "extra": {
                 "branch-alias": {
-                    "dev-master": "2.0.x-dev"
+                    "dev-master": "3.0.x-dev"
                 }
             },
             "autoload": {
@@ -210,7 +210,7 @@
                 "json",
                 "schema"
             ],
-            "time": "2016-08-15 16:39:11"
+            "time": "2016-08-26 12:45:49"
         },
         {
             "name": "liuggio/statsd-php-client",
diff --git a/composer/installed.json b/composer/installed.json
index 5c579a5..a4195d5 100644
--- a/composer/installed.json
+++ b/composer/installed.json
@@ -1606,74 +1606,6 @@
         "homepage": "https://www.mediawiki.org/wiki/WrappedString";
     },
     {
-        "name": "justinrainbow/json-schema",
-        "version": "3.0.0",
-        "version_normalized": "3.0.0.0",
-        "source": {
-            "type": "git",
-            "url": "https://github.com/justinrainbow/json-schema.git";,
-            "reference": "12965831120bb18852e9865804a6089906323b8e"
-        },
-        "dist": {
-            "type": "zip",
-            "url": 
"https://api.github.com/repos/justinrainbow/json-schema/zipball/12965831120bb18852e9865804a6089906323b8e";,
-            "reference": "12965831120bb18852e9865804a6089906323b8e",
-            "shasum": ""
-        },
-        "require": {
-            "php": ">=5.3.3"
-        },
-        "require-dev": {
-            "json-schema/json-schema-test-suite": "1.2.0",
-            "phpdocumentor/phpdocumentor": "~2",
-            "phpunit/phpunit": "^4.8.22"
-        },
-        "time": "2016-08-15 16:39:11",
-        "bin": [
-            "bin/validate-json"
-        ],
-        "type": "library",
-        "extra": {
-            "branch-alias": {
-                "dev-master": "2.0.x-dev"
-            }
-        },
-        "installation-source": "dist",
-        "autoload": {
-            "psr-4": {
-                "JsonSchema\\": "src/JsonSchema/"
-            }
-        },
-        "notification-url": "https://packagist.org/downloads/";,
-        "license": [
-            "MIT"
-        ],
-        "authors": [
-            {
-                "name": "Bruno Prieto Reis",
-                "email": "[email protected]"
-            },
-            {
-                "name": "Justin Rainbow",
-                "email": "[email protected]"
-            },
-            {
-                "name": "Igor Wiedler",
-                "email": "[email protected]"
-            },
-            {
-                "name": "Robert Schönthal",
-                "email": "[email protected]"
-            }
-        ],
-        "description": "A library to validate a json schema.",
-        "homepage": "https://github.com/justinrainbow/json-schema";,
-        "keywords": [
-            "json",
-            "schema"
-        ]
-    },
-    {
         "name": "oojs/oojs-ui",
         "version": "v0.17.9",
         "version_normalized": "0.17.9.0",
@@ -1967,5 +1899,73 @@
             "mail",
             "smtp"
         ]
+    },
+    {
+        "name": "justinrainbow/json-schema",
+        "version": "3.0.1",
+        "version_normalized": "3.0.1.0",
+        "source": {
+            "type": "git",
+            "url": "https://github.com/justinrainbow/json-schema.git";,
+            "reference": "2128f9de8be4600c3394d94c3918faf67157b76b"
+        },
+        "dist": {
+            "type": "zip",
+            "url": 
"https://api.github.com/repos/justinrainbow/json-schema/zipball/2128f9de8be4600c3394d94c3918faf67157b76b";,
+            "reference": "2128f9de8be4600c3394d94c3918faf67157b76b",
+            "shasum": ""
+        },
+        "require": {
+            "php": ">=5.3.3"
+        },
+        "require-dev": {
+            "json-schema/json-schema-test-suite": "1.2.0",
+            "phpdocumentor/phpdocumentor": "~2",
+            "phpunit/phpunit": "^4.8.22"
+        },
+        "time": "2016-08-26 12:45:49",
+        "bin": [
+            "bin/validate-json"
+        ],
+        "type": "library",
+        "extra": {
+            "branch-alias": {
+                "dev-master": "3.0.x-dev"
+            }
+        },
+        "installation-source": "dist",
+        "autoload": {
+            "psr-4": {
+                "JsonSchema\\": "src/JsonSchema/"
+            }
+        },
+        "notification-url": "https://packagist.org/downloads/";,
+        "license": [
+            "MIT"
+        ],
+        "authors": [
+            {
+                "name": "Bruno Prieto Reis",
+                "email": "[email protected]"
+            },
+            {
+                "name": "Justin Rainbow",
+                "email": "[email protected]"
+            },
+            {
+                "name": "Igor Wiedler",
+                "email": "[email protected]"
+            },
+            {
+                "name": "Robert Schönthal",
+                "email": "[email protected]"
+            }
+        ],
+        "description": "A library to validate a json schema.",
+        "homepage": "https://github.com/justinrainbow/json-schema";,
+        "keywords": [
+            "json",
+            "schema"
+        ]
     }
 ]
diff --git a/justinrainbow/json-schema/composer.json 
b/justinrainbow/json-schema/composer.json
index a6d7b42..537faa7 100644
--- a/justinrainbow/json-schema/composer.json
+++ b/justinrainbow/json-schema/composer.json
@@ -52,7 +52,7 @@
     "bin": ["bin/validate-json"],
     "extra": {
         "branch-alias": {
-            "dev-master": "2.0.x-dev"
+            "dev-master": "3.0.x-dev"
         }
     }
 }
diff --git a/justinrainbow/json-schema/src/JsonSchema/Constraints/Factory.php 
b/justinrainbow/json-schema/src/JsonSchema/Constraints/Factory.php
index bb12ece..83355c5 100644
--- a/justinrainbow/json-schema/src/JsonSchema/Constraints/Factory.php
+++ b/justinrainbow/json-schema/src/JsonSchema/Constraints/Factory.php
@@ -23,7 +23,7 @@
      * @var SchemaStorage
      */
     protected $schemaStorage;
-   
+
     /**
      * @var UriRetriever $uriRetriever
      */
@@ -57,6 +57,11 @@
     );
 
     /**
+     * @var array<ConstraintInterface>
+     */
+    private $instanceCache = array();
+
+    /**
      * @param SchemaStorage $schemaStorage
      * @param UriRetrieverInterface $uriRetriever
      * @param int $checkMode
@@ -78,7 +83,7 @@
     {
         return $this->uriRetriever;
     }
-    
+
     public function getSchemaStorage()
     {
         return $this->schemaStorage;
@@ -124,12 +129,15 @@
     public function createInstanceFor($constraintName)
     {
         if (array_key_exists($constraintName, $this->constraintMap)) {
-            return new $this->constraintMap[$constraintName](
-                $this->checkMode,
-                $this->schemaStorage,
-                $this->uriRetriever,
-                $this
-            );
+            if (!isset($this->instanceCache[$constraintName])) {
+                $this->instanceCache[$constraintName] = new 
$this->constraintMap[$constraintName](
+                    $this->checkMode,
+                    $this->schemaStorage,
+                    $this->uriRetriever,
+                    $this
+                );
+            }
+            return clone $this->instanceCache[$constraintName];
         }
         throw new InvalidArgumentException('Unknown constraint ' . 
$constraintName);
     }
diff --git 
a/justinrainbow/json-schema/src/JsonSchema/Constraints/ObjectConstraint.php 
b/justinrainbow/json-schema/src/JsonSchema/Constraints/ObjectConstraint.php
index 5a12b87..df8d808 100644
--- a/justinrainbow/json-schema/src/JsonSchema/Constraints/ObjectConstraint.php
+++ b/justinrainbow/json-schema/src/JsonSchema/Constraints/ObjectConstraint.php
@@ -105,11 +105,6 @@
                 $this->addError($path, "The presence of the property " . $i . 
" requires that " . $require . " also be present", 'requires');
             }
 
-            if (!$definition) {
-                // normal property verification
-                $this->checkUndefined($value, new \stdClass(), $path, $i);
-            }
-
             $property = $this->getProperty($element, $i, new 
UndefinedConstraint());
             if (is_object($property)) {
                 $this->validateMinMaxConstraint(!($property instanceof 
UndefinedConstraint) ? $property : $element, $definition, $path);
@@ -129,7 +124,11 @@
         foreach ($objectDefinition as $i => $value) {
             $property = $this->getProperty($element, $i, 
$this->getFactory()->createInstanceFor('undefined'));
             $definition = $this->getProperty($objectDefinition, $i);
-            $this->checkUndefined($property, $definition, $path, $i);
+
+            if (is_object($definition)) {
+                // Undefined constraint will check for is_object() and quit if 
is not - so why pass it?
+                $this->checkUndefined($property, $definition, $path, $i);
+            }
         }
     }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/313662
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I61fda77bda1b747f81103ca0747d00f2458fe526
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/vendor
Gerrit-Branch: master
Gerrit-Owner: Reedy <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to