diff --git a/composer.lock b/composer.lock index ef076a44c..16e50bdd1 100644 --- a/composer.lock +++ b/composer.lock @@ -1569,20 +1569,20 @@ }, { "name": "justinrainbow/json-schema", - "version": "v5.2.13", + "version": "5.3.0", "source": { "type": "git", "url": "https://github.com/jsonrainbow/json-schema.git", - "reference": "fbbe7e5d79f618997bc3332a6f49246036c45793" + "reference": "feb2ca6dd1cebdaf1ed60a4c8de2e53ce11c4fd8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/jsonrainbow/json-schema/zipball/fbbe7e5d79f618997bc3332a6f49246036c45793", - "reference": "fbbe7e5d79f618997bc3332a6f49246036c45793", + "url": "https://api.github.com/repos/jsonrainbow/json-schema/zipball/feb2ca6dd1cebdaf1ed60a4c8de2e53ce11c4fd8", + "reference": "feb2ca6dd1cebdaf1ed60a4c8de2e53ce11c4fd8", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.1" }, "require-dev": { "friendsofphp/php-cs-fixer": "~2.2.20||~2.15.1", @@ -1593,11 +1593,6 @@ "bin/validate-json" ], "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0.x-dev" - } - }, "autoload": { "psr-4": { "JsonSchema\\": "src/JsonSchema/" @@ -1633,9 +1628,9 @@ ], "support": { "issues": "https://github.com/jsonrainbow/json-schema/issues", - "source": "https://github.com/jsonrainbow/json-schema/tree/v5.2.13" + "source": "https://github.com/jsonrainbow/json-schema/tree/5.3.0" }, - "time": "2023-09-26T02:20:38+00:00" + "time": "2024-07-06T21:00:26+00:00" }, { "name": "kornrunner/blurhash", diff --git a/composer/installed.json b/composer/installed.json index dd2fde7f5..382e6722a 100644 --- a/composer/installed.json +++ b/composer/installed.json @@ -1626,37 +1626,32 @@ }, { "name": "justinrainbow/json-schema", - "version": "v5.2.13", - "version_normalized": "5.2.13.0", + "version": "5.3.0", + "version_normalized": "5.3.0.0", "source": { "type": "git", "url": "https://github.com/jsonrainbow/json-schema.git", - "reference": "fbbe7e5d79f618997bc3332a6f49246036c45793" + "reference": "feb2ca6dd1cebdaf1ed60a4c8de2e53ce11c4fd8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/jsonrainbow/json-schema/zipball/fbbe7e5d79f618997bc3332a6f49246036c45793", - "reference": "fbbe7e5d79f618997bc3332a6f49246036c45793", + "url": "https://api.github.com/repos/jsonrainbow/json-schema/zipball/feb2ca6dd1cebdaf1ed60a4c8de2e53ce11c4fd8", + "reference": "feb2ca6dd1cebdaf1ed60a4c8de2e53ce11c4fd8", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.1" }, "require-dev": { "friendsofphp/php-cs-fixer": "~2.2.20||~2.15.1", "json-schema/json-schema-test-suite": "1.2.0", "phpunit/phpunit": "^4.8.35" }, - "time": "2023-09-26T02:20:38+00:00", + "time": "2024-07-06T21:00:26+00:00", "bin": [ "bin/validate-json" ], "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0.x-dev" - } - }, "installation-source": "dist", "autoload": { "psr-4": { @@ -1693,7 +1688,7 @@ ], "support": { "issues": "https://github.com/jsonrainbow/json-schema/issues", - "source": "https://github.com/jsonrainbow/json-schema/tree/v5.2.13" + "source": "https://github.com/jsonrainbow/json-schema/tree/5.3.0" }, "install-path": "../justinrainbow/json-schema" }, diff --git a/composer/installed.php b/composer/installed.php index fae8128d0..7b15a19f5 100644 --- a/composer/installed.php +++ b/composer/installed.php @@ -200,9 +200,9 @@ 'dev_requirement' => false, ), 'justinrainbow/json-schema' => array( - 'pretty_version' => 'v5.2.13', - 'version' => '5.2.13.0', - 'reference' => 'fbbe7e5d79f618997bc3332a6f49246036c45793', + 'pretty_version' => '5.3.0', + 'version' => '5.3.0.0', + 'reference' => 'feb2ca6dd1cebdaf1ed60a4c8de2e53ce11c4fd8', 'type' => 'library', 'install_path' => __DIR__ . '/../justinrainbow/json-schema', 'aliases' => array(), diff --git a/justinrainbow/json-schema/src/JsonSchema/Constraints/BaseConstraint.php b/justinrainbow/json-schema/src/JsonSchema/Constraints/BaseConstraint.php index 63968213e..9a4ea1e5a 100644 --- a/justinrainbow/json-schema/src/JsonSchema/Constraints/BaseConstraint.php +++ b/justinrainbow/json-schema/src/JsonSchema/Constraints/BaseConstraint.php @@ -38,12 +38,12 @@ class BaseConstraint /** * @param Factory $factory */ - public function __construct(Factory $factory = null) + public function __construct(?Factory $factory = null) { $this->factory = $factory ?: new Factory(); } - public function addError(JsonPointer $path = null, $message, $constraint = '', array $more = null) + public function addError(?JsonPointer $path, $message, $constraint = '', ?array $more = null) { $error = array( 'property' => $this->convertJsonPointerIntoPropertyPath($path ?: new JsonPointer('')), diff --git a/justinrainbow/json-schema/src/JsonSchema/Constraints/CollectionConstraint.php b/justinrainbow/json-schema/src/JsonSchema/Constraints/CollectionConstraint.php index d1384b884..a5ddd35b8 100644 --- a/justinrainbow/json-schema/src/JsonSchema/Constraints/CollectionConstraint.php +++ b/justinrainbow/json-schema/src/JsonSchema/Constraints/CollectionConstraint.php @@ -22,7 +22,7 @@ class CollectionConstraint extends Constraint /** * {@inheritdoc} */ - public function check(&$value, $schema = null, JsonPointer $path = null, $i = null) + public function check(&$value, $schema = null, ?JsonPointer $path = null, $i = null) { // Verify minItems if (isset($schema->minItems) && count($value) < $schema->minItems) { @@ -61,7 +61,7 @@ public function check(&$value, $schema = null, JsonPointer $path = null, $i = nu * @param JsonPointer|null $path * @param string $i */ - protected function validateItems(&$value, $schema = null, JsonPointer $path = null, $i = null) + protected function validateItems(&$value, $schema = null, ?JsonPointer $path = null, $i = null) { if (is_object($schema->items)) { // just one type definition for the whole array diff --git a/justinrainbow/json-schema/src/JsonSchema/Constraints/Constraint.php b/justinrainbow/json-schema/src/JsonSchema/Constraints/Constraint.php index c61b89ad2..5aaa718c2 100644 --- a/justinrainbow/json-schema/src/JsonSchema/Constraints/Constraint.php +++ b/justinrainbow/json-schema/src/JsonSchema/Constraints/Constraint.php @@ -39,7 +39,7 @@ abstract class Constraint extends BaseConstraint implements ConstraintInterface * * @return JsonPointer; */ - protected function incrementPath(JsonPointer $path = null, $i) + protected function incrementPath(?JsonPointer $path, $i) { $path = $path ?: new JsonPointer(''); @@ -65,7 +65,7 @@ protected function incrementPath(JsonPointer $path = null, $i) * @param JsonPointer|null $path * @param mixed $i */ - protected function checkArray(&$value, $schema = null, JsonPointer $path = null, $i = null) + protected function checkArray(&$value, $schema = null, ?JsonPointer $path = null, $i = null) { $validator = $this->factory->createInstanceFor('collection'); $validator->check($value, $schema, $path, $i); @@ -83,7 +83,7 @@ protected function checkArray(&$value, $schema = null, JsonPointer $path = null, * @param mixed $additionalProperties * @param mixed $patternProperties */ - protected function checkObject(&$value, $schema = null, JsonPointer $path = null, $properties = null, + protected function checkObject(&$value, $schema = null, ?JsonPointer $path = null, $properties = null, $additionalProperties = null, $patternProperties = null, $appliedDefaults = array()) { $validator = $this->factory->createInstanceFor('object'); @@ -100,7 +100,7 @@ protected function checkObject(&$value, $schema = null, JsonPointer $path = null * @param JsonPointer|null $path * @param mixed $i */ - protected function checkType(&$value, $schema = null, JsonPointer $path = null, $i = null) + protected function checkType(&$value, $schema = null, ?JsonPointer $path = null, $i = null) { $validator = $this->factory->createInstanceFor('type'); $validator->check($value, $schema, $path, $i); @@ -116,7 +116,7 @@ protected function checkType(&$value, $schema = null, JsonPointer $path = null, * @param JsonPointer|null $path * @param mixed $i */ - protected function checkUndefined(&$value, $schema = null, JsonPointer $path = null, $i = null, $fromDefault = false) + protected function checkUndefined(&$value, $schema = null, ?JsonPointer $path = null, $i = null, $fromDefault = false) { $validator = $this->factory->createInstanceFor('undefined'); @@ -133,7 +133,7 @@ protected function checkUndefined(&$value, $schema = null, JsonPointer $path = n * @param JsonPointer|null $path * @param mixed $i */ - protected function checkString($value, $schema = null, JsonPointer $path = null, $i = null) + protected function checkString($value, $schema = null, ?JsonPointer $path = null, $i = null) { $validator = $this->factory->createInstanceFor('string'); $validator->check($value, $schema, $path, $i); @@ -149,7 +149,7 @@ protected function checkString($value, $schema = null, JsonPointer $path = null, * @param JsonPointer $path * @param mixed $i */ - protected function checkNumber($value, $schema = null, JsonPointer $path = null, $i = null) + protected function checkNumber($value, $schema = null, ?JsonPointer $path = null, $i = null) { $validator = $this->factory->createInstanceFor('number'); $validator->check($value, $schema, $path, $i); @@ -165,7 +165,7 @@ protected function checkNumber($value, $schema = null, JsonPointer $path = null, * @param JsonPointer|null $path * @param mixed $i */ - protected function checkEnum($value, $schema = null, JsonPointer $path = null, $i = null) + protected function checkEnum($value, $schema = null, ?JsonPointer $path = null, $i = null) { $validator = $this->factory->createInstanceFor('enum'); $validator->check($value, $schema, $path, $i); @@ -181,7 +181,7 @@ protected function checkEnum($value, $schema = null, JsonPointer $path = null, $ * @param JsonPointer|null $path * @param mixed $i */ - protected function checkFormat($value, $schema = null, JsonPointer $path = null, $i = null) + protected function checkFormat($value, $schema = null, ?JsonPointer $path = null, $i = null) { $validator = $this->factory->createInstanceFor('format'); $validator->check($value, $schema, $path, $i); diff --git a/justinrainbow/json-schema/src/JsonSchema/Constraints/ConstraintInterface.php b/justinrainbow/json-schema/src/JsonSchema/Constraints/ConstraintInterface.php index 442268e68..a5a235ad4 100644 --- a/justinrainbow/json-schema/src/JsonSchema/Constraints/ConstraintInterface.php +++ b/justinrainbow/json-schema/src/JsonSchema/Constraints/ConstraintInterface.php @@ -40,7 +40,7 @@ public function addErrors(array $errors); * @param string $constraint the constraint/rule that is broken, e.g.: 'minLength' * @param array $more more array elements to add to the error */ - public function addError(JsonPointer $path = null, $message, $constraint='', array $more = null); + public function addError(?JsonPointer $path, $message, $constraint='', ?array $more = null); /** * checks if the validator has not raised errors @@ -61,5 +61,5 @@ public function isValid(); * * @throws \JsonSchema\Exception\ExceptionInterface */ - public function check(&$value, $schema = null, JsonPointer $path = null, $i = null); + public function check(&$value, $schema = null, ?JsonPointer $path = null, $i = null); } diff --git a/justinrainbow/json-schema/src/JsonSchema/Constraints/EnumConstraint.php b/justinrainbow/json-schema/src/JsonSchema/Constraints/EnumConstraint.php index 0fd2b6a0a..da61c135b 100644 --- a/justinrainbow/json-schema/src/JsonSchema/Constraints/EnumConstraint.php +++ b/justinrainbow/json-schema/src/JsonSchema/Constraints/EnumConstraint.php @@ -22,7 +22,7 @@ class EnumConstraint extends Constraint /** * {@inheritdoc} */ - public function check(&$element, $schema = null, JsonPointer $path = null, $i = null) + public function check(&$element, $schema = null, ?JsonPointer $path = null, $i = null) { // Only validate enum if the attribute exists if ($element instanceof UndefinedConstraint && (!isset($schema->required) || !$schema->required)) { diff --git a/justinrainbow/json-schema/src/JsonSchema/Constraints/Factory.php b/justinrainbow/json-schema/src/JsonSchema/Constraints/Factory.php index 4e771c19c..840854b30 100644 --- a/justinrainbow/json-schema/src/JsonSchema/Constraints/Factory.php +++ b/justinrainbow/json-schema/src/JsonSchema/Constraints/Factory.php @@ -74,8 +74,8 @@ class Factory * @param int $checkMode */ public function __construct( - SchemaStorageInterface $schemaStorage = null, - UriRetrieverInterface $uriRetriever = null, + ?SchemaStorageInterface $schemaStorage = null, + ?UriRetrieverInterface $uriRetriever = null, $checkMode = Constraint::CHECK_MODE_NORMAL ) { // set provided config options diff --git a/justinrainbow/json-schema/src/JsonSchema/Constraints/FormatConstraint.php b/justinrainbow/json-schema/src/JsonSchema/Constraints/FormatConstraint.php index 578cdb14d..29843e6c9 100644 --- a/justinrainbow/json-schema/src/JsonSchema/Constraints/FormatConstraint.php +++ b/justinrainbow/json-schema/src/JsonSchema/Constraints/FormatConstraint.php @@ -24,7 +24,7 @@ class FormatConstraint extends Constraint /** * {@inheritdoc} */ - public function check(&$element, $schema = null, JsonPointer $path = null, $i = null) + public function check(&$element, $schema = null, ?JsonPointer $path = null, $i = null) { if (!isset($schema->format) || $this->factory->getConfig(self::CHECK_MODE_DISABLE_FORMAT)) { return; diff --git a/justinrainbow/json-schema/src/JsonSchema/Constraints/NumberConstraint.php b/justinrainbow/json-schema/src/JsonSchema/Constraints/NumberConstraint.php index d4c31a469..b2ade8e21 100644 --- a/justinrainbow/json-schema/src/JsonSchema/Constraints/NumberConstraint.php +++ b/justinrainbow/json-schema/src/JsonSchema/Constraints/NumberConstraint.php @@ -22,7 +22,7 @@ class NumberConstraint extends Constraint /** * {@inheritdoc} */ - public function check(&$element, $schema = null, JsonPointer $path = null, $i = null) + public function check(&$element, $schema = null, ?JsonPointer $path = null, $i = null) { // Verify minimum if (isset($schema->exclusiveMinimum)) { diff --git a/justinrainbow/json-schema/src/JsonSchema/Constraints/ObjectConstraint.php b/justinrainbow/json-schema/src/JsonSchema/Constraints/ObjectConstraint.php index 0010d2941..e99c44bcc 100644 --- a/justinrainbow/json-schema/src/JsonSchema/Constraints/ObjectConstraint.php +++ b/justinrainbow/json-schema/src/JsonSchema/Constraints/ObjectConstraint.php @@ -27,7 +27,7 @@ class ObjectConstraint extends Constraint /** * {@inheritdoc} */ - public function check(&$element, $schema = null, JsonPointer $path = null, $properties = null, + public function check(&$element, $schema = null, ?JsonPointer $path = null, $properties = null, $additionalProp = null, $patternProperties = null, $appliedDefaults = array()) { if ($element instanceof UndefinedConstraint) { @@ -51,7 +51,7 @@ public function check(&$element, $schema = null, JsonPointer $path = null, $prop $this->validateElement($element, $matches, $schema, $path, $properties, $additionalProp); } - public function validatePatternProperties($element, JsonPointer $path = null, $patternProperties) + public function validatePatternProperties($element, ?JsonPointer $path, $patternProperties) { $try = array('/', '#', '+', '~', '%'); $matches = array(); @@ -90,7 +90,7 @@ public function validatePatternProperties($element, JsonPointer $path = null, $p * @param \StdClass $properties Properties * @param mixed $additionalProp Additional properties */ - public function validateElement($element, $matches, $schema = null, JsonPointer $path = null, + public function validateElement($element, $matches, $schema = null, ?JsonPointer $path = null, $properties = null, $additionalProp = null) { $this->validateMinMaxConstraint($element, $schema, $path); @@ -132,7 +132,7 @@ public function validateElement($element, $matches, $schema = null, JsonPointer * @param \stdClass $properties Property definitions * @param JsonPointer|null $path Path? */ - public function validateProperties(&$element, $properties = null, JsonPointer $path = null) + public function validateProperties(&$element, $properties = null, ?JsonPointer $path = null) { $undefinedConstraint = $this->factory->createInstanceFor('undefined'); @@ -174,7 +174,7 @@ protected function &getProperty(&$element, $property, $fallback = null) * @param \stdClass $objectDefinition ObjectConstraint definition * @param JsonPointer|null $path Path to test? */ - protected function validateMinMaxConstraint($element, $objectDefinition, JsonPointer $path = null) + protected function validateMinMaxConstraint($element, $objectDefinition, ?JsonPointer $path = null) { // Verify minimum number of properties if (isset($objectDefinition->minProperties) && !is_object($objectDefinition->minProperties)) { diff --git a/justinrainbow/json-schema/src/JsonSchema/Constraints/SchemaConstraint.php b/justinrainbow/json-schema/src/JsonSchema/Constraints/SchemaConstraint.php index db665ad38..74979eb03 100644 --- a/justinrainbow/json-schema/src/JsonSchema/Constraints/SchemaConstraint.php +++ b/justinrainbow/json-schema/src/JsonSchema/Constraints/SchemaConstraint.php @@ -28,7 +28,7 @@ class SchemaConstraint extends Constraint /** * {@inheritdoc} */ - public function check(&$element, $schema = null, JsonPointer $path = null, $i = null) + public function check(&$element, $schema = null, ?JsonPointer $path = null, $i = null) { if ($schema !== null) { // passed schema diff --git a/justinrainbow/json-schema/src/JsonSchema/Constraints/StringConstraint.php b/justinrainbow/json-schema/src/JsonSchema/Constraints/StringConstraint.php index c66af1ed6..d6189ce0e 100644 --- a/justinrainbow/json-schema/src/JsonSchema/Constraints/StringConstraint.php +++ b/justinrainbow/json-schema/src/JsonSchema/Constraints/StringConstraint.php @@ -22,7 +22,7 @@ class StringConstraint extends Constraint /** * {@inheritdoc} */ - public function check(&$element, $schema = null, JsonPointer $path = null, $i = null) + public function check(&$element, $schema = null, ?JsonPointer $path = null, $i = null) { // Verify maxLength if (isset($schema->maxLength) && $this->strlen($element) > $schema->maxLength) { diff --git a/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeConstraint.php b/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeConstraint.php index efc0abbc4..9940fd58d 100644 --- a/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeConstraint.php +++ b/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeConstraint.php @@ -39,7 +39,7 @@ class TypeConstraint extends Constraint /** * {@inheritdoc} */ - public function check(&$value = null, $schema = null, JsonPointer $path = null, $i = null) + public function check(&$value = null, $schema = null, ?JsonPointer $path = null, $i = null) { $type = isset($schema->type) ? $schema->type : null; $isValid = false; diff --git a/justinrainbow/json-schema/src/JsonSchema/Constraints/UndefinedConstraint.php b/justinrainbow/json-schema/src/JsonSchema/Constraints/UndefinedConstraint.php index 1e984a3db..26e45f785 100644 --- a/justinrainbow/json-schema/src/JsonSchema/Constraints/UndefinedConstraint.php +++ b/justinrainbow/json-schema/src/JsonSchema/Constraints/UndefinedConstraint.php @@ -31,7 +31,7 @@ class UndefinedConstraint extends Constraint /** * {@inheritdoc} */ - public function check(&$value, $schema = null, JsonPointer $path = null, $i = null, $fromDefault = false) + public function check(&$value, $schema = null, ?JsonPointer $path = null, $i = null, $fromDefault = false) { if (is_null($schema) || !is_object($schema)) { return; diff --git a/justinrainbow/json-schema/src/JsonSchema/Exception/JsonDecodingException.php b/justinrainbow/json-schema/src/JsonSchema/Exception/JsonDecodingException.php index c77198284..7641f61bf 100644 --- a/justinrainbow/json-schema/src/JsonSchema/Exception/JsonDecodingException.php +++ b/justinrainbow/json-schema/src/JsonSchema/Exception/JsonDecodingException.php @@ -14,7 +14,7 @@ */ class JsonDecodingException extends RuntimeException { - public function __construct($code = JSON_ERROR_NONE, \Exception $previous = null) + public function __construct($code = JSON_ERROR_NONE, ?\Exception $previous = null) { switch ($code) { case JSON_ERROR_DEPTH: diff --git a/justinrainbow/json-schema/src/JsonSchema/SchemaStorage.php b/justinrainbow/json-schema/src/JsonSchema/SchemaStorage.php index 31da6685f..36ba34947 100644 --- a/justinrainbow/json-schema/src/JsonSchema/SchemaStorage.php +++ b/justinrainbow/json-schema/src/JsonSchema/SchemaStorage.php @@ -17,8 +17,8 @@ class SchemaStorage implements SchemaStorageInterface protected $schemas = array(); public function __construct( - UriRetrieverInterface $uriRetriever = null, - UriResolverInterface $uriResolver = null + ?UriRetrieverInterface $uriRetriever = null, + ?UriResolverInterface $uriResolver = null ) { $this->uriRetriever = $uriRetriever ?: new UriRetriever(); $this->uriResolver = $uriResolver ?: new UriResolver();