From 84b4368c0af77f5c7a0c674ab6172123fc8c23f9 Mon Sep 17 00:00:00 2001 From: Jack Worman Date: Thu, 20 Feb 2025 22:34:12 -0500 Subject: [PATCH 1/7] Add-return-types --- phpstan-baseline.neon | 245 ------------------ phpstan.neon | 3 +- .../Constraints/ConstConstraint.php | 2 +- src/JsonSchema/Constraints/EnumConstraint.php | 2 +- .../Constraints/FormatConstraint.php | 20 +- .../Constraints/NumberConstraint.php | 4 +- .../Constraints/ObjectConstraint.php | 15 +- .../Constraints/SchemaConstraint.php | 2 +- .../Constraints/StringConstraint.php | 12 +- .../Constraints/TypeCheck/LooseTypeCheck.php | 17 +- .../Constraints/TypeCheck/StrictTypeCheck.php | 10 +- .../TypeCheck/TypeCheckInterface.php | 13 +- src/JsonSchema/Constraints/TypeConstraint.php | 4 +- .../Constraints/UndefinedConstraint.php | 10 +- src/JsonSchema/Entity/JsonPointer.php | 2 +- .../Exception/ExceptionInterface.php | 2 +- src/JsonSchema/Iterator/ObjectIterator.php | 2 +- src/JsonSchema/SchemaStorage.php | 4 +- src/JsonSchema/SchemaStorageInterface.php | 2 +- src/JsonSchema/Uri/Retrievers/Curl.php | 2 +- src/JsonSchema/Uri/UriRetriever.php | 12 +- src/JsonSchema/UriRetrieverInterface.php | 4 +- src/JsonSchema/Validator.php | 8 +- tests/Uri/UriRetrieverTest.php | 2 +- 24 files changed, 82 insertions(+), 317 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index d4116654..6dcf82d0 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -85,11 +85,6 @@ parameters: count: 1 path: src/JsonSchema/Constraints/ConstraintInterface.php - - - message: "#^PHPDoc tag @throws with type JsonSchema\\\\Exception\\\\ExceptionInterface is not subtype of Throwable$#" - count: 1 - path: src/JsonSchema/Constraints/ConstraintInterface.php - - message: "#^Method JsonSchema\\\\Constraints\\\\Factory\\:\\:createInstanceFor\\(\\) should return JsonSchema\\\\Constraints\\\\BaseConstraint&JsonSchema\\\\Constraints\\\\ConstraintInterface but returns object\\.$#" count: 1 @@ -125,21 +120,11 @@ parameters: count: 1 path: src/JsonSchema/Constraints/Factory.php - - - message: "#^Method JsonSchema\\\\Constraints\\\\FormatConstraint\\:\\:validateColor\\(\\) has no return type specified\\.$#" - count: 1 - path: src/JsonSchema/Constraints/FormatConstraint.php - - message: "#^Method JsonSchema\\\\Constraints\\\\FormatConstraint\\:\\:validateColor\\(\\) has parameter \\$color with no type specified\\.$#" count: 1 path: src/JsonSchema/Constraints/FormatConstraint.php - - - message: "#^Method JsonSchema\\\\Constraints\\\\FormatConstraint\\:\\:validateDateTime\\(\\) has no return type specified\\.$#" - count: 1 - path: src/JsonSchema/Constraints/FormatConstraint.php - - message: "#^Method JsonSchema\\\\Constraints\\\\FormatConstraint\\:\\:validateDateTime\\(\\) has parameter \\$datetime with no type specified\\.$#" count: 1 @@ -150,51 +135,26 @@ parameters: count: 1 path: src/JsonSchema/Constraints/FormatConstraint.php - - - message: "#^Method JsonSchema\\\\Constraints\\\\FormatConstraint\\:\\:validateHostname\\(\\) has no return type specified\\.$#" - count: 1 - path: src/JsonSchema/Constraints/FormatConstraint.php - - message: "#^Method JsonSchema\\\\Constraints\\\\FormatConstraint\\:\\:validateHostname\\(\\) has parameter \\$host with no type specified\\.$#" count: 1 path: src/JsonSchema/Constraints/FormatConstraint.php - - - message: "#^Method JsonSchema\\\\Constraints\\\\FormatConstraint\\:\\:validatePhone\\(\\) has no return type specified\\.$#" - count: 1 - path: src/JsonSchema/Constraints/FormatConstraint.php - - message: "#^Method JsonSchema\\\\Constraints\\\\FormatConstraint\\:\\:validatePhone\\(\\) has parameter \\$phone with no type specified\\.$#" count: 1 path: src/JsonSchema/Constraints/FormatConstraint.php - - - message: "#^Method JsonSchema\\\\Constraints\\\\FormatConstraint\\:\\:validateRegex\\(\\) has no return type specified\\.$#" - count: 1 - path: src/JsonSchema/Constraints/FormatConstraint.php - - message: "#^Method JsonSchema\\\\Constraints\\\\FormatConstraint\\:\\:validateRegex\\(\\) has parameter \\$regex with no type specified\\.$#" count: 1 path: src/JsonSchema/Constraints/FormatConstraint.php - - - message: "#^Method JsonSchema\\\\Constraints\\\\FormatConstraint\\:\\:validateStyle\\(\\) has no return type specified\\.$#" - count: 1 - path: src/JsonSchema/Constraints/FormatConstraint.php - - message: "#^Method JsonSchema\\\\Constraints\\\\FormatConstraint\\:\\:validateStyle\\(\\) has parameter \\$style with no type specified\\.$#" count: 1 path: src/JsonSchema/Constraints/FormatConstraint.php - - - message: "#^Method JsonSchema\\\\Constraints\\\\NumberConstraint\\:\\:fmod\\(\\) has no return type specified\\.$#" - count: 1 - path: src/JsonSchema/Constraints/NumberConstraint.php - - message: "#^Method JsonSchema\\\\Constraints\\\\NumberConstraint\\:\\:fmod\\(\\) has parameter \\$number1 with no type specified\\.$#" count: 1 @@ -230,26 +190,11 @@ parameters: count: 1 path: src/JsonSchema/Constraints/ObjectConstraint.php - - - message: "#^Method JsonSchema\\\\Constraints\\\\ObjectConstraint\\:\\:validateElement\\(\\) has no return type specified\\.$#" - count: 1 - path: src/JsonSchema/Constraints/ObjectConstraint.php - - message: "#^Method JsonSchema\\\\Constraints\\\\ObjectConstraint\\:\\:validateElement\\(\\) has parameter \\$matches with no value type specified in iterable type array\\.$#" count: 1 path: src/JsonSchema/Constraints/ObjectConstraint.php - - - message: "#^Method JsonSchema\\\\Constraints\\\\ObjectConstraint\\:\\:validateMinMaxConstraint\\(\\) has no return type specified\\.$#" - count: 1 - path: src/JsonSchema/Constraints/ObjectConstraint.php - - - - message: "#^Method JsonSchema\\\\Constraints\\\\ObjectConstraint\\:\\:validatePatternProperties\\(\\) has no return type specified\\.$#" - count: 1 - path: src/JsonSchema/Constraints/ObjectConstraint.php - - message: "#^Method JsonSchema\\\\Constraints\\\\ObjectConstraint\\:\\:validatePatternProperties\\(\\) has parameter \\$element with no type specified\\.$#" count: 1 @@ -260,11 +205,6 @@ parameters: count: 1 path: src/JsonSchema/Constraints/ObjectConstraint.php - - - message: "#^Method JsonSchema\\\\Constraints\\\\ObjectConstraint\\:\\:validateProperties\\(\\) has no return type specified\\.$#" - count: 1 - path: src/JsonSchema/Constraints/ObjectConstraint.php - - message: "#^Parameter \\#2 \\$objectDefinition of method JsonSchema\\\\Constraints\\\\ObjectConstraint\\:\\:validateMinMaxConstraint\\(\\) expects stdClass, stdClass\\|null given\\.$#" count: 1 @@ -275,11 +215,6 @@ parameters: count: 1 path: src/JsonSchema/Constraints/ObjectConstraint.php - - - message: "#^Method JsonSchema\\\\Constraints\\\\StringConstraint\\:\\:strlen\\(\\) has no return type specified\\.$#" - count: 1 - path: src/JsonSchema/Constraints/StringConstraint.php - - message: "#^Method JsonSchema\\\\Constraints\\\\StringConstraint\\:\\:strlen\\(\\) has parameter \\$string with no type specified\\.$#" count: 1 @@ -290,11 +225,6 @@ parameters: count: 1 path: src/JsonSchema/Constraints/StringConstraint.php - - - message: "#^Method JsonSchema\\\\Constraints\\\\TypeCheck\\\\LooseTypeCheck\\:\\:isArray\\(\\) has no return type specified\\.$#" - count: 1 - path: src/JsonSchema/Constraints/TypeCheck/LooseTypeCheck.php - - message: "#^Method JsonSchema\\\\Constraints\\\\TypeCheck\\\\LooseTypeCheck\\:\\:isArray\\(\\) has parameter \\$value with no type specified\\.$#" count: 1 @@ -305,31 +235,16 @@ parameters: count: 1 path: src/JsonSchema/Constraints/TypeCheck/LooseTypeCheck.php - - - message: "#^Method JsonSchema\\\\Constraints\\\\TypeCheck\\\\LooseTypeCheck\\:\\:isObject\\(\\) has no return type specified\\.$#" - count: 1 - path: src/JsonSchema/Constraints/TypeCheck/LooseTypeCheck.php - - message: "#^Method JsonSchema\\\\Constraints\\\\TypeCheck\\\\LooseTypeCheck\\:\\:isObject\\(\\) has parameter \\$value with no type specified\\.$#" count: 1 path: src/JsonSchema/Constraints/TypeCheck/LooseTypeCheck.php - - - message: "#^Method JsonSchema\\\\Constraints\\\\TypeCheck\\\\LooseTypeCheck\\:\\:propertyCount\\(\\) has no return type specified\\.$#" - count: 1 - path: src/JsonSchema/Constraints/TypeCheck/LooseTypeCheck.php - - message: "#^Method JsonSchema\\\\Constraints\\\\TypeCheck\\\\LooseTypeCheck\\:\\:propertyCount\\(\\) has parameter \\$value with no type specified\\.$#" count: 1 path: src/JsonSchema/Constraints/TypeCheck/LooseTypeCheck.php - - - message: "#^Method JsonSchema\\\\Constraints\\\\TypeCheck\\\\LooseTypeCheck\\:\\:propertyExists\\(\\) has no return type specified\\.$#" - count: 1 - path: src/JsonSchema/Constraints/TypeCheck/LooseTypeCheck.php - - message: "#^Method JsonSchema\\\\Constraints\\\\TypeCheck\\\\LooseTypeCheck\\:\\:propertyExists\\(\\) has parameter \\$property with no type specified\\.$#" count: 1 @@ -340,11 +255,6 @@ parameters: count: 1 path: src/JsonSchema/Constraints/TypeCheck/LooseTypeCheck.php - - - message: "#^Method JsonSchema\\\\Constraints\\\\TypeCheck\\\\LooseTypeCheck\\:\\:propertyGet\\(\\) has no return type specified\\.$#" - count: 1 - path: src/JsonSchema/Constraints/TypeCheck/LooseTypeCheck.php - - message: "#^Method JsonSchema\\\\Constraints\\\\TypeCheck\\\\LooseTypeCheck\\:\\:propertyGet\\(\\) has parameter \\$property with no type specified\\.$#" count: 1 @@ -355,11 +265,6 @@ parameters: count: 1 path: src/JsonSchema/Constraints/TypeCheck/LooseTypeCheck.php - - - message: "#^Method JsonSchema\\\\Constraints\\\\TypeCheck\\\\LooseTypeCheck\\:\\:propertySet\\(\\) has no return type specified\\.$#" - count: 1 - path: src/JsonSchema/Constraints/TypeCheck/LooseTypeCheck.php - - message: "#^Method JsonSchema\\\\Constraints\\\\TypeCheck\\\\LooseTypeCheck\\:\\:propertySet\\(\\) has parameter \\$data with no type specified\\.$#" count: 1 @@ -375,41 +280,21 @@ parameters: count: 1 path: src/JsonSchema/Constraints/TypeCheck/LooseTypeCheck.php - - - message: "#^Method JsonSchema\\\\Constraints\\\\TypeCheck\\\\StrictTypeCheck\\:\\:isArray\\(\\) has no return type specified\\.$#" - count: 1 - path: src/JsonSchema/Constraints/TypeCheck/StrictTypeCheck.php - - message: "#^Method JsonSchema\\\\Constraints\\\\TypeCheck\\\\StrictTypeCheck\\:\\:isArray\\(\\) has parameter \\$value with no type specified\\.$#" count: 1 path: src/JsonSchema/Constraints/TypeCheck/StrictTypeCheck.php - - - message: "#^Method JsonSchema\\\\Constraints\\\\TypeCheck\\\\StrictTypeCheck\\:\\:isObject\\(\\) has no return type specified\\.$#" - count: 1 - path: src/JsonSchema/Constraints/TypeCheck/StrictTypeCheck.php - - message: "#^Method JsonSchema\\\\Constraints\\\\TypeCheck\\\\StrictTypeCheck\\:\\:isObject\\(\\) has parameter \\$value with no type specified\\.$#" count: 1 path: src/JsonSchema/Constraints/TypeCheck/StrictTypeCheck.php - - - message: "#^Method JsonSchema\\\\Constraints\\\\TypeCheck\\\\StrictTypeCheck\\:\\:propertyCount\\(\\) has no return type specified\\.$#" - count: 1 - path: src/JsonSchema/Constraints/TypeCheck/StrictTypeCheck.php - - message: "#^Method JsonSchema\\\\Constraints\\\\TypeCheck\\\\StrictTypeCheck\\:\\:propertyCount\\(\\) has parameter \\$value with no type specified\\.$#" count: 1 path: src/JsonSchema/Constraints/TypeCheck/StrictTypeCheck.php - - - message: "#^Method JsonSchema\\\\Constraints\\\\TypeCheck\\\\StrictTypeCheck\\:\\:propertyExists\\(\\) has no return type specified\\.$#" - count: 1 - path: src/JsonSchema/Constraints/TypeCheck/StrictTypeCheck.php - - message: "#^Method JsonSchema\\\\Constraints\\\\TypeCheck\\\\StrictTypeCheck\\:\\:propertyExists\\(\\) has parameter \\$property with no type specified\\.$#" count: 1 @@ -420,11 +305,6 @@ parameters: count: 1 path: src/JsonSchema/Constraints/TypeCheck/StrictTypeCheck.php - - - message: "#^Method JsonSchema\\\\Constraints\\\\TypeCheck\\\\StrictTypeCheck\\:\\:propertyGet\\(\\) has no return type specified\\.$#" - count: 1 - path: src/JsonSchema/Constraints/TypeCheck/StrictTypeCheck.php - - message: "#^Method JsonSchema\\\\Constraints\\\\TypeCheck\\\\StrictTypeCheck\\:\\:propertyGet\\(\\) has parameter \\$property with no type specified\\.$#" count: 1 @@ -435,11 +315,6 @@ parameters: count: 1 path: src/JsonSchema/Constraints/TypeCheck/StrictTypeCheck.php - - - message: "#^Method JsonSchema\\\\Constraints\\\\TypeCheck\\\\StrictTypeCheck\\:\\:propertySet\\(\\) has no return type specified\\.$#" - count: 1 - path: src/JsonSchema/Constraints/TypeCheck/StrictTypeCheck.php - - message: "#^Method JsonSchema\\\\Constraints\\\\TypeCheck\\\\StrictTypeCheck\\:\\:propertySet\\(\\) has parameter \\$data with no type specified\\.$#" count: 1 @@ -455,41 +330,21 @@ parameters: count: 1 path: src/JsonSchema/Constraints/TypeCheck/StrictTypeCheck.php - - - message: "#^Method JsonSchema\\\\Constraints\\\\TypeCheck\\\\TypeCheckInterface\\:\\:isArray\\(\\) has no return type specified\\.$#" - count: 1 - path: src/JsonSchema/Constraints/TypeCheck/TypeCheckInterface.php - - message: "#^Method JsonSchema\\\\Constraints\\\\TypeCheck\\\\TypeCheckInterface\\:\\:isArray\\(\\) has parameter \\$value with no type specified\\.$#" count: 1 path: src/JsonSchema/Constraints/TypeCheck/TypeCheckInterface.php - - - message: "#^Method JsonSchema\\\\Constraints\\\\TypeCheck\\\\TypeCheckInterface\\:\\:isObject\\(\\) has no return type specified\\.$#" - count: 1 - path: src/JsonSchema/Constraints/TypeCheck/TypeCheckInterface.php - - message: "#^Method JsonSchema\\\\Constraints\\\\TypeCheck\\\\TypeCheckInterface\\:\\:isObject\\(\\) has parameter \\$value with no type specified\\.$#" count: 1 path: src/JsonSchema/Constraints/TypeCheck/TypeCheckInterface.php - - - message: "#^Method JsonSchema\\\\Constraints\\\\TypeCheck\\\\TypeCheckInterface\\:\\:propertyCount\\(\\) has no return type specified\\.$#" - count: 1 - path: src/JsonSchema/Constraints/TypeCheck/TypeCheckInterface.php - - message: "#^Method JsonSchema\\\\Constraints\\\\TypeCheck\\\\TypeCheckInterface\\:\\:propertyCount\\(\\) has parameter \\$value with no type specified\\.$#" count: 1 path: src/JsonSchema/Constraints/TypeCheck/TypeCheckInterface.php - - - message: "#^Method JsonSchema\\\\Constraints\\\\TypeCheck\\\\TypeCheckInterface\\:\\:propertyExists\\(\\) has no return type specified\\.$#" - count: 1 - path: src/JsonSchema/Constraints/TypeCheck/TypeCheckInterface.php - - message: "#^Method JsonSchema\\\\Constraints\\\\TypeCheck\\\\TypeCheckInterface\\:\\:propertyExists\\(\\) has parameter \\$property with no type specified\\.$#" count: 1 @@ -500,11 +355,6 @@ parameters: count: 1 path: src/JsonSchema/Constraints/TypeCheck/TypeCheckInterface.php - - - message: "#^Method JsonSchema\\\\Constraints\\\\TypeCheck\\\\TypeCheckInterface\\:\\:propertyGet\\(\\) has no return type specified\\.$#" - count: 1 - path: src/JsonSchema/Constraints/TypeCheck/TypeCheckInterface.php - - message: "#^Method JsonSchema\\\\Constraints\\\\TypeCheck\\\\TypeCheckInterface\\:\\:propertyGet\\(\\) has parameter \\$property with no type specified\\.$#" count: 1 @@ -515,11 +365,6 @@ parameters: count: 1 path: src/JsonSchema/Constraints/TypeCheck/TypeCheckInterface.php - - - message: "#^Method JsonSchema\\\\Constraints\\\\TypeCheck\\\\TypeCheckInterface\\:\\:propertySet\\(\\) has no return type specified\\.$#" - count: 1 - path: src/JsonSchema/Constraints/TypeCheck/TypeCheckInterface.php - - message: "#^Method JsonSchema\\\\Constraints\\\\TypeCheck\\\\TypeCheckInterface\\:\\:propertySet\\(\\) has parameter \\$data with no type specified\\.$#" count: 1 @@ -545,16 +390,6 @@ parameters: count: 1 path: src/JsonSchema/Constraints/TypeConstraint.php - - - message: "#^Method JsonSchema\\\\Constraints\\\\TypeConstraint\\:\\:validateTypeNameWording\\(\\) has no return type specified\\.$#" - count: 1 - path: src/JsonSchema/Constraints/TypeConstraint.php - - - - message: "#^Method JsonSchema\\\\Constraints\\\\TypeConstraint\\:\\:validateTypesArray\\(\\) has no return type specified\\.$#" - count: 1 - path: src/JsonSchema/Constraints/TypeConstraint.php - - message: "#^Method JsonSchema\\\\Constraints\\\\TypeConstraint\\:\\:validateTypesArray\\(\\) has parameter \\$type with no value type specified in iterable type array\\.$#" count: 1 @@ -590,31 +425,6 @@ parameters: count: 1 path: src/JsonSchema/Constraints/UndefinedConstraint.php - - - message: "#^Method JsonSchema\\\\Constraints\\\\UndefinedConstraint\\:\\:validateCommonProperties\\(\\) has no return type specified\\.$#" - count: 1 - path: src/JsonSchema/Constraints/UndefinedConstraint.php - - - - message: "#^Method JsonSchema\\\\Constraints\\\\UndefinedConstraint\\:\\:validateDependencies\\(\\) has no return type specified\\.$#" - count: 1 - path: src/JsonSchema/Constraints/UndefinedConstraint.php - - - - message: "#^Method JsonSchema\\\\Constraints\\\\UndefinedConstraint\\:\\:validateOfProperties\\(\\) has no return type specified\\.$#" - count: 1 - path: src/JsonSchema/Constraints/UndefinedConstraint.php - - - - message: "#^Method JsonSchema\\\\Constraints\\\\UndefinedConstraint\\:\\:validateTypes\\(\\) has no return type specified\\.$#" - count: 1 - path: src/JsonSchema/Constraints/UndefinedConstraint.php - - - - message: "#^Method JsonSchema\\\\Constraints\\\\UndefinedConstraint\\:\\:validateUri\\(\\) has no return type specified\\.$#" - count: 1 - path: src/JsonSchema/Constraints/UndefinedConstraint.php - - message: "#^Method JsonSchema\\\\Constraints\\\\UndefinedConstraint\\:\\:validateUri\\(\\) has parameter \\$schema with no type specified\\.$#" count: 1 @@ -635,11 +445,6 @@ parameters: count: 1 path: src/JsonSchema/Entity/JsonPointer.php - - - message: "#^Method JsonSchema\\\\Entity\\\\JsonPointer\\:\\:setFromDefault\\(\\) has no return type specified\\.$#" - count: 1 - path: src/JsonSchema/Entity/JsonPointer.php - - message: "#^Method JsonSchema\\\\Entity\\\\JsonPointer\\:\\:withPropertyPaths\\(\\) has parameter \\$propertyPaths with no value type specified in iterable type array\\.$#" count: 1 @@ -670,11 +475,6 @@ parameters: count: 1 path: src/JsonSchema/Iterator/ObjectIterator.php - - - message: "#^Method JsonSchema\\\\Iterator\\\\ObjectIterator\\:\\:initialize\\(\\) has no return type specified\\.$#" - count: 1 - path: src/JsonSchema/Iterator/ObjectIterator.php - - message: "#^Property JsonSchema\\\\Iterator\\\\ObjectIterator\\:\\:\\$data type has no value type specified in iterable type array\\.$#" count: 1 @@ -710,16 +510,6 @@ parameters: count: 1 path: src/JsonSchema/SchemaStorage.php - - - message: "#^Method JsonSchema\\\\SchemaStorage\\:\\:addSchema\\(\\) has no return type specified\\.$#" - count: 1 - path: src/JsonSchema/SchemaStorage.php - - - - message: "#^Method JsonSchema\\\\SchemaStorage\\:\\:expandRefs\\(\\) has no return type specified\\.$#" - count: 1 - path: src/JsonSchema/SchemaStorage.php - - message: "#^Method JsonSchema\\\\SchemaStorage\\:\\:resolveRef\\(\\) has parameter \\$resolveStack with no type specified\\.$#" count: 1 @@ -750,16 +540,6 @@ parameters: count: 1 path: src/JsonSchema/SchemaStorage.php - - - message: "#^Method JsonSchema\\\\SchemaStorageInterface\\:\\:addSchema\\(\\) has no return type specified\\.$#" - count: 1 - path: src/JsonSchema/SchemaStorageInterface.php - - - - message: "#^Method JsonSchema\\\\Uri\\\\Retrievers\\\\Curl\\:\\:fetchMessageBody\\(\\) has no return type specified\\.$#" - count: 1 - path: src/JsonSchema/Uri/Retrievers/Curl.php - - message: "#^Offset 1 does not exist on array\\{0\\?\\: string, 1\\?\\: string\\}\\.$#" count: 1 @@ -855,11 +635,6 @@ parameters: count: 1 path: src/JsonSchema/Uri/UriRetriever.php - - - message: "#^Method JsonSchema\\\\Uri\\\\UriRetriever\\:\\:addInvalidContentTypeEndpoint\\(\\) has no return type specified\\.$#" - count: 1 - path: src/JsonSchema/Uri/UriRetriever.php - - message: "#^Method JsonSchema\\\\Uri\\\\UriRetriever\\:\\:generate\\(\\) has parameter \\$components with no value type specified in iterable type array\\.$#" count: 1 @@ -880,11 +655,6 @@ parameters: count: 1 path: src/JsonSchema/Uri/UriRetriever.php - - - message: "#^Method JsonSchema\\\\Uri\\\\UriRetriever\\:\\:setTranslation\\(\\) has no return type specified\\.$#" - count: 1 - path: src/JsonSchema/Uri/UriRetriever.php - - message: "#^Method JsonSchema\\\\Uri\\\\UriRetriever\\:\\:setTranslation\\(\\) has parameter \\$from with no type specified\\.$#" count: 1 @@ -895,11 +665,6 @@ parameters: count: 1 path: src/JsonSchema/Uri/UriRetriever.php - - - message: "#^Method JsonSchema\\\\Uri\\\\UriRetriever\\:\\:translate\\(\\) has no return type specified\\.$#" - count: 1 - path: src/JsonSchema/Uri/UriRetriever.php - - message: "#^Method JsonSchema\\\\Uri\\\\UriRetriever\\:\\:translate\\(\\) has parameter \\$uri with no type specified\\.$#" count: 1 @@ -920,11 +685,6 @@ parameters: count: 1 path: src/JsonSchema/Uri/UriRetriever.php - - - message: "#^Method JsonSchema\\\\Validator\\:\\:check\\(\\) has no return type specified\\.$#" - count: 1 - path: src/JsonSchema/Validator.php - - message: "#^Method JsonSchema\\\\Validator\\:\\:check\\(\\) has parameter \\$schema with no type specified\\.$#" count: 1 @@ -935,11 +695,6 @@ parameters: count: 1 path: src/JsonSchema/Validator.php - - - message: "#^Method JsonSchema\\\\Validator\\:\\:coerce\\(\\) has no return type specified\\.$#" - count: 1 - path: src/JsonSchema/Validator.php - - message: "#^Method JsonSchema\\\\Validator\\:\\:coerce\\(\\) has parameter \\$schema with no type specified\\.$#" count: 1 diff --git a/phpstan.neon b/phpstan.neon index 26b360ae..a413c58c 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -2,7 +2,8 @@ parameters: level: 8 paths: - ./src/ - ignoreErrors: [] +# ignoreErrors: +# - message: '~has no return type specified~' phpVersion: 70200 includes: diff --git a/src/JsonSchema/Constraints/ConstConstraint.php b/src/JsonSchema/Constraints/ConstConstraint.php index 6e3a14bc..28e326d3 100644 --- a/src/JsonSchema/Constraints/ConstConstraint.php +++ b/src/JsonSchema/Constraints/ConstConstraint.php @@ -25,7 +25,7 @@ class ConstConstraint extends Constraint /** * {@inheritdoc} */ - public function check(&$element, $schema = null, ?JsonPointer $path = null, $i = null): void + public function check(& $element, $schema = null, ?JsonPointer $path = null, $i = null): void { // Only validate const if the attribute exists if ($element instanceof UndefinedConstraint && (!isset($schema->required) || !$schema->required)) { diff --git a/src/JsonSchema/Constraints/EnumConstraint.php b/src/JsonSchema/Constraints/EnumConstraint.php index 1f30fadf..ed166562 100644 --- a/src/JsonSchema/Constraints/EnumConstraint.php +++ b/src/JsonSchema/Constraints/EnumConstraint.php @@ -26,7 +26,7 @@ class EnumConstraint extends Constraint /** * {@inheritdoc} */ - public function check(&$element, $schema = null, ?JsonPointer $path = null, $i = null): void + public function check(& $element, $schema = null, ?JsonPointer $path = null, $i = null): void { // Only validate enum if the attribute exists if ($element instanceof UndefinedConstraint && (!isset($schema->required) || !$schema->required)) { diff --git a/src/JsonSchema/Constraints/FormatConstraint.php b/src/JsonSchema/Constraints/FormatConstraint.php index 5b07c0b5..c47618f4 100644 --- a/src/JsonSchema/Constraints/FormatConstraint.php +++ b/src/JsonSchema/Constraints/FormatConstraint.php @@ -27,7 +27,7 @@ class FormatConstraint extends Constraint /** * {@inheritdoc} */ - public function check(&$element, $schema = null, ?JsonPointer $path = null, $i = null): void + public function check(& $element, $schema = null, ?JsonPointer $path = null, $i = null): void { if (!isset($schema->format) || $this->factory->getConfig(self::CHECK_MODE_DISABLE_FORMAT)) { return; @@ -169,7 +169,7 @@ public function check(&$element, $schema = null, ?JsonPointer $path = null, $i = } } - protected function validateDateTime($datetime, $format) + protected function validateDateTime($datetime, $format): bool { $dt = \DateTime::createFromFormat($format, (string) $datetime); @@ -184,7 +184,7 @@ protected function validateDateTime($datetime, $format) return false; } - protected function validateRegex($regex) + protected function validateRegex($regex): bool { if (!is_string($regex)) { return true; @@ -193,7 +193,7 @@ protected function validateRegex($regex) return false !== @preg_match(self::jsonPatternToPhpRegex($regex), ''); } - protected function validateColor($color) + protected function validateColor($color): bool { if (!is_string($color)) { return true; @@ -205,10 +205,10 @@ protected function validateColor($color) return true; } - return preg_match('/^#([a-f0-9]{3}|[a-f0-9]{6})$/i', $color); + return 1 === preg_match('/^#([a-f0-9]{3}|[a-f0-9]{6})$/i', $color); } - protected function validateStyle($style) + protected function validateStyle($style): bool { $properties = explode(';', rtrim($style, ';')); $invalidEntries = preg_grep('/^\s*[-a-z]+\s*:\s*.+$/i', $properties, PREG_GREP_INVERT); @@ -216,12 +216,12 @@ protected function validateStyle($style) return empty($invalidEntries); } - protected function validatePhone($phone) + protected function validatePhone($phone): bool { - return preg_match('/^\+?(\(\d{3}\)|\d{3}) \d{3} \d{4}$/', $phone); + return 1 === preg_match('/^\+?(\(\d{3}\)|\d{3}) \d{3} \d{4}$/', $phone); } - protected function validateHostname($host) + protected function validateHostname($host): bool { if (!is_string($host)) { return true; @@ -229,6 +229,6 @@ protected function validateHostname($host) $hostnameRegex = '/^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$/i'; - return preg_match($hostnameRegex, $host); + return 1 === preg_match($hostnameRegex, $host); } } diff --git a/src/JsonSchema/Constraints/NumberConstraint.php b/src/JsonSchema/Constraints/NumberConstraint.php index e1b2ffc3..d5292e85 100644 --- a/src/JsonSchema/Constraints/NumberConstraint.php +++ b/src/JsonSchema/Constraints/NumberConstraint.php @@ -25,7 +25,7 @@ class NumberConstraint extends Constraint /** * {@inheritdoc} */ - public function check(&$element, $schema = null, ?JsonPointer $path = null, $i = null): void + public function check(& $element, $schema = null, ?JsonPointer $path = null, $i = null): void { // Verify minimum if (isset($schema->exclusiveMinimum)) { @@ -70,7 +70,7 @@ public function check(&$element, $schema = null, ?JsonPointer $path = null, $i = $this->checkFormat($element, $schema, $path, $i); } - private function fmod($number1, $number2) + private function fmod($number1, $number2): float { $modulus = ($number1 - round($number1 / $number2) * $number2); $precision = 0.0000000001; diff --git a/src/JsonSchema/Constraints/ObjectConstraint.php b/src/JsonSchema/Constraints/ObjectConstraint.php index 011e600c..6493afb4 100644 --- a/src/JsonSchema/Constraints/ObjectConstraint.php +++ b/src/JsonSchema/Constraints/ObjectConstraint.php @@ -30,7 +30,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 = []): void { if ($element instanceof UndefinedConstraint) { @@ -54,7 +54,10 @@ public function check(&$element, $schema = null, ?JsonPointer $path = null, $pro $this->validateElement($element, $matches, $schema, $path, $properties, $additionalProp); } - public function validatePatternProperties($element, ?JsonPointer $path, $patternProperties) + /** + * @return list + */ + public function validatePatternProperties($element, ?JsonPointer $path, $patternProperties): array { $matches = []; foreach ($patternProperties as $pregex => $schema) { @@ -87,7 +90,7 @@ public function validatePatternProperties($element, ?JsonPointer $path, $pattern * @param mixed $additionalProp Additional properties */ public function validateElement($element, $matches, $schema = null, ?JsonPointer $path = null, - $properties = null, $additionalProp = null) + $properties = null, $additionalProp = null): void { $this->validateMinMaxConstraint($element, $schema, $path); @@ -131,7 +134,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): void { $undefinedConstraint = $this->factory->createInstanceFor('undefined'); @@ -155,7 +158,7 @@ public function validateProperties(&$element, $properties = null, ?JsonPointer $ * * @return mixed */ - protected function &getProperty(&$element, $property, $fallback = null) + protected function &getProperty(& $element, $property, $fallback = null) { if (is_array($element) && (isset($element[$property]) || array_key_exists($property, $element)) /*$this->checkMode == self::CHECK_MODE_TYPE_CAST*/) { return $element[$property]; @@ -173,7 +176,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): void { // Verify minimum number of properties if (isset($objectDefinition->minProperties) && !is_object($objectDefinition->minProperties)) { diff --git a/src/JsonSchema/Constraints/SchemaConstraint.php b/src/JsonSchema/Constraints/SchemaConstraint.php index 7852e851..5e406f49 100644 --- a/src/JsonSchema/Constraints/SchemaConstraint.php +++ b/src/JsonSchema/Constraints/SchemaConstraint.php @@ -31,7 +31,7 @@ class SchemaConstraint extends Constraint /** * {@inheritdoc} */ - public function check(&$element, $schema = null, ?JsonPointer $path = null, $i = null): void + public function check(& $element, $schema = null, ?JsonPointer $path = null, $i = null): void { if ($schema !== null) { // passed schema diff --git a/src/JsonSchema/Constraints/StringConstraint.php b/src/JsonSchema/Constraints/StringConstraint.php index 7b811614..832ce3e9 100644 --- a/src/JsonSchema/Constraints/StringConstraint.php +++ b/src/JsonSchema/Constraints/StringConstraint.php @@ -13,6 +13,7 @@ use JsonSchema\ConstraintError; use JsonSchema\Entity\JsonPointer; +use JsonSchema\Exception\RuntimeException; /** * The StringConstraint Constraints, validates an string against a given schema @@ -25,7 +26,7 @@ class StringConstraint extends Constraint /** * {@inheritdoc} */ - public function check(&$element, $schema = null, ?JsonPointer $path = null, $i = null): void + public function check(& $element, $schema = null, ?JsonPointer $path = null, $i = null): void { // Verify maxLength if (isset($schema->maxLength) && $this->strlen($element) > $schema->maxLength) { @@ -51,10 +52,15 @@ public function check(&$element, $schema = null, ?JsonPointer $path = null, $i = $this->checkFormat($element, $schema, $path, $i); } - private function strlen($string) + private function strlen($string): int { if (extension_loaded('mbstring')) { - return mb_strlen($string, mb_detect_encoding($string)); + $result = mb_strlen($string, mb_detect_encoding($string)); + if ($result === false) { + throw new RuntimeException('mb_strlen() failed.'); + } + + return $result; } // mbstring is present on all test platforms, so strlen() can be ignored for coverage diff --git a/src/JsonSchema/Constraints/TypeCheck/LooseTypeCheck.php b/src/JsonSchema/Constraints/TypeCheck/LooseTypeCheck.php index 18057512..fb947d9a 100644 --- a/src/JsonSchema/Constraints/TypeCheck/LooseTypeCheck.php +++ b/src/JsonSchema/Constraints/TypeCheck/LooseTypeCheck.php @@ -6,20 +6,23 @@ class LooseTypeCheck implements TypeCheckInterface { - public static function isObject($value) + public static function isObject($value): bool { return is_object($value) || (is_array($value) && (count($value) == 0 || self::isAssociativeArray($value))); } - public static function isArray($value) + public static function isArray($value): bool { return is_array($value) && (count($value) == 0 || !self::isAssociativeArray($value)); } + /** + * @return mixed + */ public static function propertyGet($value, $property) { if (is_object($value)) { @@ -29,7 +32,7 @@ public static function propertyGet($value, $property) return $value[$property]; } - public static function propertySet(&$value, $property, $data) + public static function propertySet(&$value, $property, $data): void { if (is_object($value)) { $value->{$property} = $data; @@ -38,7 +41,7 @@ public static function propertySet(&$value, $property, $data) } } - public static function propertyExists($value, $property) + public static function propertyExists($value, $property): bool { if (is_object($value)) { return property_exists($value, $property); @@ -47,7 +50,7 @@ public static function propertyExists($value, $property) return array_key_exists($property, $value); } - public static function propertyCount($value) + public static function propertyCount($value): int { if (is_object($value)) { return count(get_object_vars($value)); @@ -60,10 +63,8 @@ public static function propertyCount($value) * Check if the provided array is associative or not * * @param array $arr - * - * @return bool */ - private static function isAssociativeArray($arr) + private static function isAssociativeArray($arr): bool { return array_keys($arr) !== range(0, count($arr) - 1); } diff --git a/src/JsonSchema/Constraints/TypeCheck/StrictTypeCheck.php b/src/JsonSchema/Constraints/TypeCheck/StrictTypeCheck.php index b0aa813a..00825b2b 100644 --- a/src/JsonSchema/Constraints/TypeCheck/StrictTypeCheck.php +++ b/src/JsonSchema/Constraints/TypeCheck/StrictTypeCheck.php @@ -6,12 +6,12 @@ class StrictTypeCheck implements TypeCheckInterface { - public static function isObject($value) + public static function isObject($value): bool { return is_object($value); } - public static function isArray($value) + public static function isArray($value): bool { return is_array($value); } @@ -21,17 +21,17 @@ public static function propertyGet($value, $property) return $value->{$property}; } - public static function propertySet(&$value, $property, $data) + public static function propertySet(&$value, $property, $data): void { $value->{$property} = $data; } - public static function propertyExists($value, $property) + public static function propertyExists($value, $property): bool { return property_exists($value, $property); } - public static function propertyCount($value) + public static function propertyCount($value): int { if (!is_object($value)) { return 0; diff --git a/src/JsonSchema/Constraints/TypeCheck/TypeCheckInterface.php b/src/JsonSchema/Constraints/TypeCheck/TypeCheckInterface.php index 0333b0aa..3c9e15c2 100644 --- a/src/JsonSchema/Constraints/TypeCheck/TypeCheckInterface.php +++ b/src/JsonSchema/Constraints/TypeCheck/TypeCheckInterface.php @@ -6,15 +6,18 @@ interface TypeCheckInterface { - public static function isObject($value); + public static function isObject($value): bool; - public static function isArray($value); + public static function isArray($value): bool; + /** + * @return mixed + */ public static function propertyGet($value, $property); - public static function propertySet(&$value, $property, $data); + public static function propertySet(&$value, $property, $data): void; - public static function propertyExists($value, $property); + public static function propertyExists($value, $property): bool; - public static function propertyCount($value); + public static function propertyCount($value): int; } diff --git a/src/JsonSchema/Constraints/TypeConstraint.php b/src/JsonSchema/Constraints/TypeConstraint.php index fc1aa4eb..0a3b4398 100644 --- a/src/JsonSchema/Constraints/TypeConstraint.php +++ b/src/JsonSchema/Constraints/TypeConstraint.php @@ -90,7 +90,7 @@ public function check(&$value = null, $schema = null, ?JsonPointer $path = null, * @param ?JsonPointer $path * @param bool $coerce */ - protected function validateTypesArray(&$value, array $type, &$validTypesWording, &$isValid, $path, $coerce = false) + protected function validateTypesArray(&$value, array $type, &$validTypesWording, &$isValid, $path, $coerce = false): void { foreach ($type as $tp) { // already valid, so no need to waste cycles looping over everything @@ -151,7 +151,7 @@ protected function implodeWith(array $elements, $delimiter = ', ', $listEnd = fa * * @throws StandardUnexpectedValueException */ - protected function validateTypeNameWording($type) + protected function validateTypeNameWording($type): void { if (!array_key_exists($type, self::$wording)) { throw new StandardUnexpectedValueException( diff --git a/src/JsonSchema/Constraints/UndefinedConstraint.php b/src/JsonSchema/Constraints/UndefinedConstraint.php index 4d955cff..0101d052 100644 --- a/src/JsonSchema/Constraints/UndefinedConstraint.php +++ b/src/JsonSchema/Constraints/UndefinedConstraint.php @@ -63,7 +63,7 @@ public function check(&$value, $schema = null, ?JsonPointer $path = null, $i = n * @param JsonPointer $path * @param string $i */ - public function validateTypes(&$value, $schema, JsonPointer $path, $i = null) + public function validateTypes(&$value, $schema, JsonPointer $path, $i = null): void { // check array if ($this->getTypeCheck()->isArray($value)) { @@ -114,7 +114,7 @@ public function validateTypes(&$value, $schema, JsonPointer $path, $i = null) * @param JsonPointer $path * @param string $i */ - protected function validateCommonProperties(&$value, $schema, JsonPointer $path, $i = '') + protected function validateCommonProperties(&$value, $schema, JsonPointer $path, $i = ''): void { // if it extends another schema, it must pass that schema as well if (isset($schema->extends)) { @@ -310,7 +310,7 @@ protected function applyDefaultValues(&$value, $schema, $path): void * @param JsonPointer $path * @param string $i */ - protected function validateOfProperties(&$value, $schema, JsonPointer $path, $i = '') + protected function validateOfProperties(&$value, $schema, JsonPointer $path, $i = ''): void { // Verify type if ($value instanceof self) { @@ -384,7 +384,7 @@ protected function validateOfProperties(&$value, $schema, JsonPointer $path, $i * @param JsonPointer $path * @param string $i */ - protected function validateDependencies($value, $dependencies, JsonPointer $path, $i = '') + protected function validateDependencies($value, $dependencies, JsonPointer $path, $i = ''): void { foreach ($dependencies as $key => $dependency) { if ($this->getTypeCheck()->propertyExists($value, $key)) { @@ -414,7 +414,7 @@ protected function validateDependencies($value, $dependencies, JsonPointer $path } } - protected function validateUri($schema, $schemaUri = null) + protected function validateUri($schema, $schemaUri = null): ?object { $resolver = new UriResolver(); $retriever = $this->factory->getUriRetriever(); diff --git a/src/JsonSchema/Entity/JsonPointer.php b/src/JsonSchema/Entity/JsonPointer.php index ee4a1d35..e674fa6f 100644 --- a/src/JsonSchema/Entity/JsonPointer.php +++ b/src/JsonSchema/Entity/JsonPointer.php @@ -146,7 +146,7 @@ public function __toString() /** * Mark the value at this path as being set from a schema default */ - public function setFromDefault() + public function setFromDefault(): void { $this->fromDefault = true; } diff --git a/src/JsonSchema/Exception/ExceptionInterface.php b/src/JsonSchema/Exception/ExceptionInterface.php index c72d4197..5b27c2ae 100644 --- a/src/JsonSchema/Exception/ExceptionInterface.php +++ b/src/JsonSchema/Exception/ExceptionInterface.php @@ -4,6 +4,6 @@ namespace JsonSchema\Exception; -interface ExceptionInterface +interface ExceptionInterface extends \Throwable { } diff --git a/src/JsonSchema/Iterator/ObjectIterator.php b/src/JsonSchema/Iterator/ObjectIterator.php index 9eb121cb..fa2fd86d 100644 --- a/src/JsonSchema/Iterator/ObjectIterator.php +++ b/src/JsonSchema/Iterator/ObjectIterator.php @@ -100,7 +100,7 @@ public function count(): int /** * Initializer */ - private function initialize() + private function initialize(): void { if (!$this->initialized) { $this->data = $this->buildDataFromObject($this->object); diff --git a/src/JsonSchema/SchemaStorage.php b/src/JsonSchema/SchemaStorage.php index 34f0daae..fce02817 100644 --- a/src/JsonSchema/SchemaStorage.php +++ b/src/JsonSchema/SchemaStorage.php @@ -45,7 +45,7 @@ public function getUriResolver() /** * {@inheritdoc} */ - public function addSchema($id, $schema = null) + public function addSchema($id, $schema = null): void { if (is_null($schema) && $id !== self::INTERNAL_PROVIDED_SCHEMA_URI) { // if the schema was user-provided to Validator and is still null, then assume this is @@ -82,7 +82,7 @@ public function addSchema($id, $schema = null) * @param mixed $schema * @param string $base */ - private function expandRefs(&$schema, $base = null) + private function expandRefs(& $schema, $base = null): void { if (!is_object($schema)) { if (is_array($schema)) { diff --git a/src/JsonSchema/SchemaStorageInterface.php b/src/JsonSchema/SchemaStorageInterface.php index eca44283..ea26f7f4 100644 --- a/src/JsonSchema/SchemaStorageInterface.php +++ b/src/JsonSchema/SchemaStorageInterface.php @@ -12,7 +12,7 @@ interface SchemaStorageInterface * @param string $id * @param object $schema */ - public function addSchema($id, $schema = null); + public function addSchema($id, $schema = null): void; /** * Returns schema for given identifier, or null if it does not exist diff --git a/src/JsonSchema/Uri/Retrievers/Curl.php b/src/JsonSchema/Uri/Retrievers/Curl.php index 116607ae..37488f66 100644 --- a/src/JsonSchema/Uri/Retrievers/Curl.php +++ b/src/JsonSchema/Uri/Retrievers/Curl.php @@ -61,7 +61,7 @@ public function retrieve($uri) /** * @param string $response cURL HTTP response */ - private function fetchMessageBody($response) + private function fetchMessageBody($response): void { preg_match("/(?:\r\n){2}(.*)$/ms", $response, $match); $this->messageBody = $match[1]; diff --git a/src/JsonSchema/Uri/UriRetriever.php b/src/JsonSchema/Uri/UriRetriever.php index 4094cccc..db287d94 100644 --- a/src/JsonSchema/Uri/UriRetriever.php +++ b/src/JsonSchema/Uri/UriRetriever.php @@ -59,7 +59,7 @@ class UriRetriever implements BaseUriRetrieverInterface * * @param string $endpoint */ - public function addInvalidContentTypeEndpoint($endpoint) + public function addInvalidContentTypeEndpoint($endpoint): void { $this->allowedInvalidContentTypeEndpoints[] = $endpoint; } @@ -163,7 +163,7 @@ public function resolvePointer($jsonSchema, $uri) /** * {@inheritdoc} */ - public function retrieve($uri, $baseUri = null, $translate = true) + public function retrieve($uri, $baseUri = null, $translate = true): ?object { $resolver = new UriResolver(); $resolvedUri = $fetchUri = $resolver->resolve($uri, $baseUri); @@ -316,10 +316,8 @@ public function resolve($uri, $baseUri = null) /** * @param string $uri - * - * @return bool */ - public function isValid($uri) + public function isValid($uri): bool { $components = $this->parse($uri); @@ -329,7 +327,7 @@ public function isValid($uri) /** * Set a URL translation rule */ - public function setTranslation($from, $to) + public function setTranslation($from, $to): void { $this->translationMap[$from] = $to; } @@ -337,7 +335,7 @@ public function setTranslation($from, $to) /** * Apply URI translation rules */ - public function translate($uri) + public function translate($uri): string { foreach ($this->translationMap as $from => $to) { $uri = preg_replace($from, $to, $uri); diff --git a/src/JsonSchema/UriRetrieverInterface.php b/src/JsonSchema/UriRetrieverInterface.php index 6f503221..1a1428d5 100644 --- a/src/JsonSchema/UriRetrieverInterface.php +++ b/src/JsonSchema/UriRetrieverInterface.php @@ -22,7 +22,7 @@ interface UriRetrieverInterface * @param string $uri JSON Schema URI * @param null|string $baseUri * - * @return object JSON Schema contents + * @return object|null JSON Schema contents */ - public function retrieve($uri, $baseUri = null); + public function retrieve($uri, $baseUri = null): ?object; } diff --git a/src/JsonSchema/Validator.php b/src/JsonSchema/Validator.php index a02c2e5d..5d677189 100644 --- a/src/JsonSchema/Validator.php +++ b/src/JsonSchema/Validator.php @@ -42,12 +42,10 @@ class Validator extends BaseConstraint * @param mixed $schema * @param int $checkMode * - * @return int - * * @phpstan-param int-mask-of $checkMode * @phpstan-return int-mask-of */ - public function validate(&$value, $schema = null, $checkMode = null) + public function validate(&$value, $schema = null, $checkMode = null): int { // reset errors prior to validation $this->reset(); @@ -84,7 +82,7 @@ public function validate(&$value, $schema = null, $checkMode = null) * * @deprecated */ - public function check($value, $schema) + public function check($value, $schema): int { return $this->validate($value, $schema); } @@ -94,7 +92,7 @@ public function check($value, $schema) * * @deprecated */ - public function coerce(&$value, $schema) + public function coerce(&$value, $schema): int { return $this->validate($value, $schema, Constraint::CHECK_MODE_COERCE_TYPES); } diff --git a/tests/Uri/UriRetrieverTest.php b/tests/Uri/UriRetrieverTest.php index 81419269..e03ad0de 100644 --- a/tests/Uri/UriRetrieverTest.php +++ b/tests/Uri/UriRetrieverTest.php @@ -108,7 +108,7 @@ public function testResolveRelativeUri($childSchema, $parentSchema): void $this->assertTrue($this->validator->isValid()); } - private static function setParentSchemaExtendsValue(&$parentSchema, $value): void + private static function setParentSchemaExtendsValue(& $parentSchema, $value): void { $parentSchemaDecoded = json_decode($parentSchema, true); $parentSchemaDecoded['extends'] = $value; From 7ace407357ec3540834816c7d4d6237b318dbdc1 Mon Sep 17 00:00:00 2001 From: Jack Worman Date: Thu, 20 Feb 2025 22:36:27 -0500 Subject: [PATCH 2/7] Add-return-types --- phpstan-baseline.neon | 290 ++++++++++++++++++ phpstan.neon | 4 +- .../Constraints/ConstConstraint.php | 2 +- src/JsonSchema/Constraints/EnumConstraint.php | 2 +- .../Constraints/FormatConstraint.php | 2 +- .../Constraints/NumberConstraint.php | 2 +- .../Constraints/ObjectConstraint.php | 6 +- .../Constraints/SchemaConstraint.php | 2 +- .../Constraints/StringConstraint.php | 2 +- src/JsonSchema/SchemaStorage.php | 2 +- tests/Uri/UriRetrieverTest.php | 2 +- 11 files changed, 302 insertions(+), 14 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 6dcf82d0..efb75fbb 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -35,26 +35,71 @@ parameters: count: 3 path: src/JsonSchema/Constraints/CollectionConstraint.php + - + message: "#^Cannot access property \\$items on mixed\\.$#" + count: 1 + path: src/JsonSchema/Constraints/CollectionConstraint.php + - message: "#^Cannot access property \\$items on stdClass\\|null\\.$#" count: 6 path: src/JsonSchema/Constraints/CollectionConstraint.php + - + message: "#^Cannot access property \\$maxItems on mixed\\.$#" + count: 1 + path: src/JsonSchema/Constraints/CollectionConstraint.php + + - + message: "#^Cannot access property \\$minItems on mixed\\.$#" + count: 1 + path: src/JsonSchema/Constraints/CollectionConstraint.php + + - + message: "#^Cannot access property \\$uniqueItems on mixed\\.$#" + count: 1 + path: src/JsonSchema/Constraints/CollectionConstraint.php + - message: "#^Method JsonSchema\\\\Constraints\\\\CollectionConstraint\\:\\:validateItems\\(\\) has parameter \\$value with no value type specified in iterable type array\\.$#" count: 1 path: src/JsonSchema/Constraints/CollectionConstraint.php + - + message: "#^Parameter \\#1 \\$array of function array_unique expects array, mixed given\\.$#" + count: 1 + path: src/JsonSchema/Constraints/CollectionConstraint.php + - message: "#^Parameter \\#1 \\$object_or_class of function property_exists expects object\\|string, stdClass\\|null given\\.$#" count: 1 path: src/JsonSchema/Constraints/CollectionConstraint.php + - + message: "#^Parameter \\#1 \\$var of function count expects array\\|Countable, mixed given\\.$#" + count: 3 + path: src/JsonSchema/Constraints/CollectionConstraint.php + - message: "#^Parameter \\#2 \\$schema of method JsonSchema\\\\Constraints\\\\CollectionConstraint\\:\\:validateItems\\(\\) expects stdClass\\|null, object given\\.$#" count: 1 path: src/JsonSchema/Constraints/CollectionConstraint.php + - + message: "#^Parameter \\#4 \\$i of method JsonSchema\\\\Constraints\\\\CollectionConstraint\\:\\:validateItems\\(\\) expects string\\|null, mixed given\\.$#" + count: 1 + path: src/JsonSchema/Constraints/CollectionConstraint.php + + - + message: "#^Cannot access property \\$const on mixed\\.$#" + count: 2 + path: src/JsonSchema/Constraints/ConstConstraint.php + + - + message: "#^Cannot access property \\$required on mixed\\.$#" + count: 1 + path: src/JsonSchema/Constraints/ConstConstraint.php + - message: "#^Method JsonSchema\\\\Constraints\\\\Constraint\\:\\:checkObject\\(\\) has parameter \\$appliedDefaults with no type specified\\.$#" count: 1 @@ -85,6 +130,16 @@ parameters: count: 1 path: src/JsonSchema/Constraints/ConstraintInterface.php + - + message: "#^Cannot access property \\$enum on mixed\\.$#" + count: 2 + path: src/JsonSchema/Constraints/EnumConstraint.php + + - + message: "#^Cannot access property \\$required on mixed\\.$#" + count: 1 + path: src/JsonSchema/Constraints/EnumConstraint.php + - message: "#^Method JsonSchema\\\\Constraints\\\\Factory\\:\\:createInstanceFor\\(\\) should return JsonSchema\\\\Constraints\\\\BaseConstraint&JsonSchema\\\\Constraints\\\\ConstraintInterface but returns object\\.$#" count: 1 @@ -120,6 +175,11 @@ parameters: count: 1 path: src/JsonSchema/Constraints/Factory.php + - + message: "#^Cannot access property \\$format on mixed\\.$#" + count: 1 + path: src/JsonSchema/Constraints/FormatConstraint.php + - message: "#^Method JsonSchema\\\\Constraints\\\\FormatConstraint\\:\\:validateColor\\(\\) has parameter \\$color with no type specified\\.$#" count: 1 @@ -155,6 +215,36 @@ parameters: count: 1 path: src/JsonSchema/Constraints/FormatConstraint.php + - + message: "#^Cannot access property \\$divisibleBy on mixed\\.$#" + count: 1 + path: src/JsonSchema/Constraints/NumberConstraint.php + + - + message: "#^Cannot access property \\$exclusiveMaximum on mixed\\.$#" + count: 1 + path: src/JsonSchema/Constraints/NumberConstraint.php + + - + message: "#^Cannot access property \\$exclusiveMinimum on mixed\\.$#" + count: 1 + path: src/JsonSchema/Constraints/NumberConstraint.php + + - + message: "#^Cannot access property \\$maximum on mixed\\.$#" + count: 1 + path: src/JsonSchema/Constraints/NumberConstraint.php + + - + message: "#^Cannot access property \\$minimum on mixed\\.$#" + count: 1 + path: src/JsonSchema/Constraints/NumberConstraint.php + + - + message: "#^Cannot access property \\$multipleOf on mixed\\.$#" + count: 1 + path: src/JsonSchema/Constraints/NumberConstraint.php + - message: "#^Method JsonSchema\\\\Constraints\\\\NumberConstraint\\:\\:fmod\\(\\) has parameter \\$number1 with no type specified\\.$#" count: 1 @@ -210,11 +300,51 @@ parameters: count: 1 path: src/JsonSchema/Constraints/ObjectConstraint.php + - + message: "#^Parameter \\#2 \\$properties of method JsonSchema\\\\Constraints\\\\ObjectConstraint\\:\\:validateProperties\\(\\) expects stdClass\\|null, mixed given\\.$#" + count: 1 + path: src/JsonSchema/Constraints/ObjectConstraint.php + + - + message: "#^Parameter \\#2 \\$property of method JsonSchema\\\\Constraints\\\\ObjectConstraint\\:\\:getProperty\\(\\) expects string, mixed given\\.$#" + count: 1 + path: src/JsonSchema/Constraints/ObjectConstraint.php + + - + message: "#^Parameter \\#3 \\$schema of method JsonSchema\\\\Constraints\\\\ObjectConstraint\\:\\:validateElement\\(\\) expects stdClass\\|null, mixed given\\.$#" + count: 1 + path: src/JsonSchema/Constraints/ObjectConstraint.php + + - + message: "#^Parameter \\#5 \\$properties of method JsonSchema\\\\Constraints\\\\ObjectConstraint\\:\\:validateElement\\(\\) expects stdClass\\|null, mixed given\\.$#" + count: 1 + path: src/JsonSchema/Constraints/ObjectConstraint.php + - message: "#^Property JsonSchema\\\\Constraints\\\\ObjectConstraint\\:\\:\\$appliedDefaults type has no value type specified in iterable type array\\.$#" count: 1 path: src/JsonSchema/Constraints/ObjectConstraint.php + - + message: "#^Parameter \\#1 \\$id of method JsonSchema\\\\SchemaStorageInterface\\:\\:getSchema\\(\\) expects string, mixed given\\.$#" + count: 1 + path: src/JsonSchema/Constraints/SchemaConstraint.php + + - + message: "#^Cannot access property \\$maxLength on mixed\\.$#" + count: 1 + path: src/JsonSchema/Constraints/StringConstraint.php + + - + message: "#^Cannot access property \\$minLength on mixed\\.$#" + count: 1 + path: src/JsonSchema/Constraints/StringConstraint.php + + - + message: "#^Cannot access property \\$pattern on mixed\\.$#" + count: 1 + path: src/JsonSchema/Constraints/StringConstraint.php + - message: "#^Method JsonSchema\\\\Constraints\\\\StringConstraint\\:\\:strlen\\(\\) has parameter \\$string with no type specified\\.$#" count: 1 @@ -225,6 +355,11 @@ parameters: count: 1 path: src/JsonSchema/Constraints/StringConstraint.php + - + message: "#^Parameter \\#2 \\$subject of function preg_match expects string, mixed given\\.$#" + count: 1 + path: src/JsonSchema/Constraints/StringConstraint.php + - message: "#^Method JsonSchema\\\\Constraints\\\\TypeCheck\\\\LooseTypeCheck\\:\\:isArray\\(\\) has parameter \\$value with no type specified\\.$#" count: 1 @@ -380,6 +515,11 @@ parameters: count: 1 path: src/JsonSchema/Constraints/TypeCheck/TypeCheckInterface.php + - + message: "#^Cannot access property \\$type on mixed\\.$#" + count: 1 + path: src/JsonSchema/Constraints/TypeConstraint.php + - message: "#^Method JsonSchema\\\\Constraints\\\\TypeConstraint\\:\\:implodeWith\\(\\) has parameter \\$elements with no value type specified in iterable type array\\.$#" count: 1 @@ -405,6 +545,16 @@ parameters: count: 2 path: src/JsonSchema/Constraints/TypeConstraint.php + - + message: "#^Parameter \\#1 \\$array of function reset expects array\\|object, mixed given\\.$#" + count: 4 + path: src/JsonSchema/Constraints/TypeConstraint.php + + - + message: "#^Parameter \\#1 \\$var of function count expects array\\|Countable, mixed given\\.$#" + count: 4 + path: src/JsonSchema/Constraints/TypeConstraint.php + - message: "#^Parameter \\#3 \\$listEnd of method JsonSchema\\\\Constraints\\\\TypeConstraint\\:\\:implodeWith\\(\\) expects bool, string given\\.$#" count: 1 @@ -415,6 +565,91 @@ parameters: count: 1 path: src/JsonSchema/Constraints/TypeConstraint.php + - + message: "#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#" + count: 1 + path: src/JsonSchema/Constraints/UndefinedConstraint.php + + - + message: "#^Cannot access offset mixed on mixed\\.$#" + count: 2 + path: src/JsonSchema/Constraints/UndefinedConstraint.php + + - + message: "#^Cannot access property \\$additionalProperties on mixed\\.$#" + count: 1 + path: src/JsonSchema/Constraints/UndefinedConstraint.php + + - + message: "#^Cannot access property \\$allOf on mixed\\.$#" + count: 1 + path: src/JsonSchema/Constraints/UndefinedConstraint.php + + - + message: "#^Cannot access property \\$anyOf on mixed\\.$#" + count: 1 + path: src/JsonSchema/Constraints/UndefinedConstraint.php + + - + message: "#^Cannot access property \\$const on mixed\\.$#" + count: 1 + path: src/JsonSchema/Constraints/UndefinedConstraint.php + + - + message: "#^Cannot access property \\$default on mixed\\.$#" + count: 3 + path: src/JsonSchema/Constraints/UndefinedConstraint.php + + - + message: "#^Cannot access property \\$dependencies on mixed\\.$#" + count: 1 + path: src/JsonSchema/Constraints/UndefinedConstraint.php + + - + message: "#^Cannot access property \\$disallow on mixed\\.$#" + count: 1 + path: src/JsonSchema/Constraints/UndefinedConstraint.php + + - + message: "#^Cannot access property \\$enum on mixed\\.$#" + count: 1 + path: src/JsonSchema/Constraints/UndefinedConstraint.php + + - + message: "#^Cannot access property \\$extends on mixed\\.$#" + count: 1 + path: src/JsonSchema/Constraints/UndefinedConstraint.php + + - + message: "#^Cannot access property \\$items on mixed\\.$#" + count: 1 + path: src/JsonSchema/Constraints/UndefinedConstraint.php + + - + message: "#^Cannot access property \\$not on mixed\\.$#" + count: 1 + path: src/JsonSchema/Constraints/UndefinedConstraint.php + + - + message: "#^Cannot access property \\$oneOf on mixed\\.$#" + count: 1 + path: src/JsonSchema/Constraints/UndefinedConstraint.php + + - + message: "#^Cannot access property \\$patternProperties on mixed\\.$#" + count: 1 + path: src/JsonSchema/Constraints/UndefinedConstraint.php + + - + message: "#^Cannot access property \\$properties on mixed\\.$#" + count: 2 + path: src/JsonSchema/Constraints/UndefinedConstraint.php + + - + message: "#^Cannot access property \\$required on mixed\\.$#" + count: 4 + path: src/JsonSchema/Constraints/UndefinedConstraint.php + - message: "#^Method JsonSchema\\\\Constraints\\\\UndefinedConstraint\\:\\:check\\(\\) has parameter \\$fromDefault with no type specified\\.$#" count: 1 @@ -435,6 +670,31 @@ parameters: count: 1 path: src/JsonSchema/Constraints/UndefinedConstraint.php + - + message: "#^Parameter \\#1 \\$object_or_class of function property_exists expects object\\|string, mixed given\\.$#" + count: 1 + path: src/JsonSchema/Constraints/UndefinedConstraint.php + + - + message: "#^Parameter \\#1 \\$var of function count expects array\\|Countable, mixed given\\.$#" + count: 3 + path: src/JsonSchema/Constraints/UndefinedConstraint.php + + - + message: "#^Parameter \\#2 \\$search of function array_key_exists expects array, mixed given\\.$#" + count: 1 + path: src/JsonSchema/Constraints/UndefinedConstraint.php + + - + message: "#^Parameter \\#4 \\$i of method JsonSchema\\\\Constraints\\\\UndefinedConstraint\\:\\:validateCommonProperties\\(\\) expects string, mixed given\\.$#" + count: 1 + path: src/JsonSchema/Constraints/UndefinedConstraint.php + + - + message: "#^Parameter \\#4 \\$i of method JsonSchema\\\\Constraints\\\\UndefinedConstraint\\:\\:validateTypes\\(\\) expects string\\|null, mixed given\\.$#" + count: 1 + path: src/JsonSchema/Constraints/UndefinedConstraint.php + - message: "#^Property JsonSchema\\\\Constraints\\\\UndefinedConstraint\\:\\:\\$appliedDefaults type has no value type specified in iterable type array\\.$#" count: 1 @@ -475,6 +735,11 @@ parameters: count: 1 path: src/JsonSchema/Iterator/ObjectIterator.php + - + message: "#^Parameter \\#1 \\$item of method JsonSchema\\\\Iterator\\\\ObjectIterator\\:\\:getDataFromItem\\(\\) expects array\\|object, mixed given\\.$#" + count: 1 + path: src/JsonSchema/Iterator/ObjectIterator.php + - message: "#^Property JsonSchema\\\\Iterator\\\\ObjectIterator\\:\\:\\$data type has no value type specified in iterable type array\\.$#" count: 1 @@ -520,6 +785,11 @@ parameters: count: 1 path: src/JsonSchema/SchemaStorage.php + - + message: "#^Method JsonSchema\\\\SchemaStorage\\:\\:resolveRefSchema\\(\\) should return object but returns mixed\\.$#" + count: 1 + path: src/JsonSchema/SchemaStorage.php + - message: "#^Property JsonSchema\\\\SchemaStorage\\:\\:\\$schemas has no type specified\\.$#" count: 1 @@ -645,6 +915,11 @@ parameters: count: 1 path: src/JsonSchema/Uri/UriRetriever.php + - + message: "#^Method JsonSchema\\\\Uri\\\\UriRetriever\\:\\:loadSchema\\(\\) should return object but returns mixed\\.$#" + count: 1 + path: src/JsonSchema/Uri/UriRetriever.php + - message: "#^Method JsonSchema\\\\Uri\\\\UriRetriever\\:\\:parse\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 @@ -670,6 +945,11 @@ parameters: count: 1 path: src/JsonSchema/Uri/UriRetriever.php + - + message: "#^Parameter \\#1 \\$json of function json_decode expects string, mixed given\\.$#" + count: 1 + path: src/JsonSchema/Uri/UriRetriever.php + - message: "#^Parameter \\#1 \\$uri of method JsonSchema\\\\Uri\\\\UriRetriever\\:\\:parse\\(\\) expects string, string\\|null given\\.$#" count: 1 @@ -680,6 +960,11 @@ parameters: count: 1 path: src/JsonSchema/Uri/UriRetriever.php + - + message: "#^Property JsonSchema\\\\Uri\\\\UriRetriever\\:\\:\\$schemaCache \\(array\\\\) does not accept array\\.$#" + count: 1 + path: src/JsonSchema/Uri/UriRetriever.php + - message: "#^Property JsonSchema\\\\Uri\\\\UriRetriever\\:\\:\\$translationMap type has no value type specified in iterable type array\\.$#" count: 1 @@ -705,3 +990,8 @@ parameters: count: 1 path: src/JsonSchema/Validator.php + - + message: "#^Parameter \\#2 \\$schema of method JsonSchema\\\\SchemaStorageInterface\\:\\:addSchema\\(\\) expects object\\|null, mixed given\\.$#" + count: 1 + path: src/JsonSchema/Validator.php + diff --git a/phpstan.neon b/phpstan.neon index a413c58c..92d8664f 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,9 +1,7 @@ parameters: - level: 8 + level: max paths: - ./src/ -# ignoreErrors: -# - message: '~has no return type specified~' phpVersion: 70200 includes: diff --git a/src/JsonSchema/Constraints/ConstConstraint.php b/src/JsonSchema/Constraints/ConstConstraint.php index 28e326d3..6e3a14bc 100644 --- a/src/JsonSchema/Constraints/ConstConstraint.php +++ b/src/JsonSchema/Constraints/ConstConstraint.php @@ -25,7 +25,7 @@ class ConstConstraint extends Constraint /** * {@inheritdoc} */ - public function check(& $element, $schema = null, ?JsonPointer $path = null, $i = null): void + public function check(&$element, $schema = null, ?JsonPointer $path = null, $i = null): void { // Only validate const if the attribute exists if ($element instanceof UndefinedConstraint && (!isset($schema->required) || !$schema->required)) { diff --git a/src/JsonSchema/Constraints/EnumConstraint.php b/src/JsonSchema/Constraints/EnumConstraint.php index ed166562..1f30fadf 100644 --- a/src/JsonSchema/Constraints/EnumConstraint.php +++ b/src/JsonSchema/Constraints/EnumConstraint.php @@ -26,7 +26,7 @@ class EnumConstraint extends Constraint /** * {@inheritdoc} */ - public function check(& $element, $schema = null, ?JsonPointer $path = null, $i = null): void + public function check(&$element, $schema = null, ?JsonPointer $path = null, $i = null): void { // Only validate enum if the attribute exists if ($element instanceof UndefinedConstraint && (!isset($schema->required) || !$schema->required)) { diff --git a/src/JsonSchema/Constraints/FormatConstraint.php b/src/JsonSchema/Constraints/FormatConstraint.php index c47618f4..eb76198e 100644 --- a/src/JsonSchema/Constraints/FormatConstraint.php +++ b/src/JsonSchema/Constraints/FormatConstraint.php @@ -27,7 +27,7 @@ class FormatConstraint extends Constraint /** * {@inheritdoc} */ - public function check(& $element, $schema = null, ?JsonPointer $path = null, $i = null): void + public function check(&$element, $schema = null, ?JsonPointer $path = null, $i = null): void { if (!isset($schema->format) || $this->factory->getConfig(self::CHECK_MODE_DISABLE_FORMAT)) { return; diff --git a/src/JsonSchema/Constraints/NumberConstraint.php b/src/JsonSchema/Constraints/NumberConstraint.php index d5292e85..2e802bb1 100644 --- a/src/JsonSchema/Constraints/NumberConstraint.php +++ b/src/JsonSchema/Constraints/NumberConstraint.php @@ -25,7 +25,7 @@ class NumberConstraint extends Constraint /** * {@inheritdoc} */ - public function check(& $element, $schema = null, ?JsonPointer $path = null, $i = null): void + public function check(&$element, $schema = null, ?JsonPointer $path = null, $i = null): void { // Verify minimum if (isset($schema->exclusiveMinimum)) { diff --git a/src/JsonSchema/Constraints/ObjectConstraint.php b/src/JsonSchema/Constraints/ObjectConstraint.php index 6493afb4..706883f3 100644 --- a/src/JsonSchema/Constraints/ObjectConstraint.php +++ b/src/JsonSchema/Constraints/ObjectConstraint.php @@ -30,7 +30,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 = []): void { if ($element instanceof UndefinedConstraint) { @@ -134,7 +134,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): void + public function validateProperties(&$element, $properties = null, ?JsonPointer $path = null): void { $undefinedConstraint = $this->factory->createInstanceFor('undefined'); @@ -158,7 +158,7 @@ public function validateProperties(& $element, $properties = null, ?JsonPointer * * @return mixed */ - protected function &getProperty(& $element, $property, $fallback = null) + protected function &getProperty(&$element, $property, $fallback = null) { if (is_array($element) && (isset($element[$property]) || array_key_exists($property, $element)) /*$this->checkMode == self::CHECK_MODE_TYPE_CAST*/) { return $element[$property]; diff --git a/src/JsonSchema/Constraints/SchemaConstraint.php b/src/JsonSchema/Constraints/SchemaConstraint.php index 5e406f49..7852e851 100644 --- a/src/JsonSchema/Constraints/SchemaConstraint.php +++ b/src/JsonSchema/Constraints/SchemaConstraint.php @@ -31,7 +31,7 @@ class SchemaConstraint extends Constraint /** * {@inheritdoc} */ - public function check(& $element, $schema = null, ?JsonPointer $path = null, $i = null): void + public function check(&$element, $schema = null, ?JsonPointer $path = null, $i = null): void { if ($schema !== null) { // passed schema diff --git a/src/JsonSchema/Constraints/StringConstraint.php b/src/JsonSchema/Constraints/StringConstraint.php index 832ce3e9..c972f6b5 100644 --- a/src/JsonSchema/Constraints/StringConstraint.php +++ b/src/JsonSchema/Constraints/StringConstraint.php @@ -26,7 +26,7 @@ class StringConstraint extends Constraint /** * {@inheritdoc} */ - public function check(& $element, $schema = null, ?JsonPointer $path = null, $i = null): void + public function check(&$element, $schema = null, ?JsonPointer $path = null, $i = null): void { // Verify maxLength if (isset($schema->maxLength) && $this->strlen($element) > $schema->maxLength) { diff --git a/src/JsonSchema/SchemaStorage.php b/src/JsonSchema/SchemaStorage.php index fce02817..8e48442a 100644 --- a/src/JsonSchema/SchemaStorage.php +++ b/src/JsonSchema/SchemaStorage.php @@ -82,7 +82,7 @@ public function addSchema($id, $schema = null): void * @param mixed $schema * @param string $base */ - private function expandRefs(& $schema, $base = null): void + private function expandRefs(&$schema, $base = null): void { if (!is_object($schema)) { if (is_array($schema)) { diff --git a/tests/Uri/UriRetrieverTest.php b/tests/Uri/UriRetrieverTest.php index e03ad0de..81419269 100644 --- a/tests/Uri/UriRetrieverTest.php +++ b/tests/Uri/UriRetrieverTest.php @@ -108,7 +108,7 @@ public function testResolveRelativeUri($childSchema, $parentSchema): void $this->assertTrue($this->validator->isValid()); } - private static function setParentSchemaExtendsValue(& $parentSchema, $value): void + private static function setParentSchemaExtendsValue(&$parentSchema, $value): void { $parentSchemaDecoded = json_decode($parentSchema, true); $parentSchemaDecoded['extends'] = $value; From c87b23c2ab7def2ba2affe77a149c4580b752d4a Mon Sep 17 00:00:00 2001 From: Jack Worman Date: Fri, 21 Feb 2025 08:21:10 -0500 Subject: [PATCH 3/7] Add-return-types --- bin/validate-json | 3 +- src/JsonSchema/ConstraintError.php | 5 +-- src/JsonSchema/Constraints/Factory.php | 1 - src/JsonSchema/Constraints/TypeConstraint.php | 8 +--- .../Constraints/UndefinedConstraint.php | 4 +- src/JsonSchema/Entity/JsonPointer.php | 42 +++++-------------- src/JsonSchema/Iterator/ObjectIterator.php | 8 +--- src/JsonSchema/Rfc3339.php | 4 +- src/JsonSchema/SchemaStorage.php | 16 +++---- src/JsonSchema/SchemaStorageInterface.php | 9 ++-- .../Uri/Retrievers/AbstractRetriever.php | 4 +- src/JsonSchema/Uri/Retrievers/Curl.php | 4 +- .../Uri/Retrievers/FileGetContents.php | 8 ++-- .../Uri/Retrievers/PredefinedArray.php | 2 +- .../Uri/Retrievers/UriRetrieverInterface.php | 8 +--- src/JsonSchema/Uri/UriResolver.php | 20 +++------ src/JsonSchema/Uri/UriRetriever.php | 34 +++++---------- src/JsonSchema/UriResolverInterface.php | 2 +- 18 files changed, 54 insertions(+), 128 deletions(-) diff --git a/bin/validate-json b/bin/validate-json index 83f0e2a8..2bad7672 100755 --- a/bin/validate-json +++ b/bin/validate-json @@ -92,11 +92,10 @@ function getUrlFromPath($path) /** * Take a HTTP header value and split it up into parts. * - * @param $headerValue * @return array Key "_value" contains the main value, all others * as given in the header value */ -function parseHeaderValue($headerValue) +function parseHeaderValue($headerValue): array { if (strpos($headerValue, ';') === false) { return ['_value' => $headerValue]; diff --git a/src/JsonSchema/ConstraintError.php b/src/JsonSchema/ConstraintError.php index 8b1c1450..417d32b3 100644 --- a/src/JsonSchema/ConstraintError.php +++ b/src/JsonSchema/ConstraintError.php @@ -54,10 +54,7 @@ class ConstraintError extends Enum public const TYPE = 'type'; public const UNIQUE_ITEMS = 'uniqueItems'; - /** - * @return string - */ - public function getMessage() + public function getMessage(): string { $name = $this->getValue(); static $messages = [ diff --git a/src/JsonSchema/Constraints/Factory.php b/src/JsonSchema/Constraints/Factory.php index b9220b9d..330d641b 100644 --- a/src/JsonSchema/Constraints/Factory.php +++ b/src/JsonSchema/Constraints/Factory.php @@ -180,7 +180,6 @@ public function setConstraintClass(string $name, string $class): Factory * @throws InvalidArgumentException if is not possible create the constraint instance * * @return ConstraintInterface&BaseConstraint - * @phpstan-return ConstraintInterface&BaseConstraint */ public function createInstanceFor($constraintName) { diff --git a/src/JsonSchema/Constraints/TypeConstraint.php b/src/JsonSchema/Constraints/TypeConstraint.php index 0a3b4398..8de580d3 100644 --- a/src/JsonSchema/Constraints/TypeConstraint.php +++ b/src/JsonSchema/Constraints/TypeConstraint.php @@ -128,10 +128,8 @@ protected function validateTypesArray(&$value, array $type, &$validTypesWording, * @param array $elements The elements to implode * @param string $delimiter The delimiter to use * @param bool $listEnd The last delimiter to use (defaults to $delimiter) - * - * @return string */ - protected function implodeWith(array $elements, $delimiter = ', ', $listEnd = false) + protected function implodeWith(array $elements, $delimiter = ', ', $listEnd = false): string { if ($listEnd === false || !isset($elements[1])) { return implode($delimiter, $elements); @@ -170,10 +168,8 @@ protected function validateTypeNameWording($type): void * @param string $type TypeConstraint to check against * * @throws InvalidArgumentException - * - * @return bool */ - protected function validateType(&$value, $type, $coerce = false) + protected function validateType(&$value, $type, $coerce = false): bool { //mostly the case for inline schema if (!$type) { diff --git a/src/JsonSchema/Constraints/UndefinedConstraint.php b/src/JsonSchema/Constraints/UndefinedConstraint.php index 0101d052..519ad826 100644 --- a/src/JsonSchema/Constraints/UndefinedConstraint.php +++ b/src/JsonSchema/Constraints/UndefinedConstraint.php @@ -210,10 +210,8 @@ protected function validateCommonProperties(&$value, $schema, JsonPointer $path, * @param mixed $schema * @param mixed $parentSchema * @param bool $requiredOnly - * - * @return bool */ - private function shouldApplyDefaultValue($requiredOnly, $schema, $name = null, $parentSchema = null) + private function shouldApplyDefaultValue($requiredOnly, $schema, $name = null, $parentSchema = null): bool { // required-only mode is off if (!$requiredOnly) { diff --git a/src/JsonSchema/Entity/JsonPointer.php b/src/JsonSchema/Entity/JsonPointer.php index e674fa6f..f0972ecb 100644 --- a/src/JsonSchema/Entity/JsonPointer.php +++ b/src/JsonSchema/Entity/JsonPointer.php @@ -54,7 +54,7 @@ public function __construct($value) * * @return string[] */ - private function decodePropertyPaths($propertyPathString) + private function decodePropertyPaths($propertyPathString): array { $paths = []; foreach (explode('/', trim($propertyPathString, '/')) as $path) { @@ -67,10 +67,7 @@ private function decodePropertyPaths($propertyPathString) return $paths; } - /** - * @return array - */ - private function encodePropertyPaths() + private function encodePropertyPaths(): array { return array_map( [$this, 'encodePath'], @@ -80,28 +77,21 @@ private function encodePropertyPaths() /** * @param string $path - * - * @return string */ - private function decodePath($path) + private function decodePath($path): string { return strtr($path, ['~1' => '/', '~0' => '~', '%25' => '%']); } /** * @param string $path - * - * @return string */ - private function encodePath($path) + private function encodePath($path): string { return strtr($path, ['/' => '~1', '~' => '~0', '%' => '%25']); } - /** - * @return string - */ - public function getFilename() + public function getFilename(): string { return $this->filename; } @@ -109,17 +99,15 @@ public function getFilename() /** * @return string[] */ - public function getPropertyPaths() + public function getPropertyPaths(): array { return $this->propertyPaths; } /** - * @param array $propertyPaths - * - * @return JsonPointer + * @return static */ - public function withPropertyPaths(array $propertyPaths) + public function withPropertyPaths(array $propertyPaths): JsonPointer { $new = clone $this; $new->propertyPaths = array_map(function ($p): string { return (string) $p; }, $propertyPaths); @@ -127,18 +115,12 @@ public function withPropertyPaths(array $propertyPaths) return $new; } - /** - * @return string - */ - public function getPropertyPathAsString() + public function getPropertyPathAsString(): string { return rtrim('#/' . implode('/', $this->encodePropertyPaths()), '/'); } - /** - * @return string - */ - public function __toString() + public function __toString(): string { return $this->getFilename() . $this->getPropertyPathAsString(); } @@ -153,10 +135,8 @@ public function setFromDefault(): void /** * Check whether the value at this path was set from a schema default - * - * @return bool */ - public function fromDefault() + public function fromDefault(): bool { return $this->fromDefault; } diff --git a/src/JsonSchema/Iterator/ObjectIterator.php b/src/JsonSchema/Iterator/ObjectIterator.php index fa2fd86d..f7634f65 100644 --- a/src/JsonSchema/Iterator/ObjectIterator.php +++ b/src/JsonSchema/Iterator/ObjectIterator.php @@ -110,10 +110,8 @@ private function initialize(): void /** * @param object $object - * - * @return array */ - private function buildDataFromObject($object) + private function buildDataFromObject($object): array { $result = []; @@ -138,10 +136,8 @@ private function buildDataFromObject($object) /** * @param object|array $item - * - * @return array */ - private function getDataFromItem($item) + private function getDataFromItem($item): array { if (!is_object($item) && !is_array($item)) { return []; diff --git a/src/JsonSchema/Rfc3339.php b/src/JsonSchema/Rfc3339.php index 3524f681..ff18a672 100644 --- a/src/JsonSchema/Rfc3339.php +++ b/src/JsonSchema/Rfc3339.php @@ -12,10 +12,8 @@ class Rfc3339 * Try creating a DateTime instance * * @param string $string - * - * @return \DateTime|null */ - public static function createFromString($string) + public static function createFromString($string): ?\DateTime { if (!preg_match(self::REGEX, strtoupper($string), $matches)) { return null; diff --git a/src/JsonSchema/SchemaStorage.php b/src/JsonSchema/SchemaStorage.php index 8e48442a..f70a1ec4 100644 --- a/src/JsonSchema/SchemaStorage.php +++ b/src/JsonSchema/SchemaStorage.php @@ -26,18 +26,12 @@ public function __construct( $this->uriResolver = $uriResolver ?: new UriResolver(); } - /** - * @return UriRetrieverInterface - */ - public function getUriRetriever() + public function getUriRetriever(): UriRetrieverInterface { return $this->uriRetriever; } - /** - * @return UriResolverInterface - */ - public function getUriResolver() + public function getUriResolver(): UriResolverInterface { return $this->uriResolver; } @@ -109,7 +103,7 @@ private function expandRefs(&$schema, $base = null): void } /** - * {@inheritdoc} + * @return object|string|false|null */ public function getSchema($id) { @@ -121,7 +115,7 @@ public function getSchema($id) } /** - * {@inheritdoc} + * @return object|false */ public function resolveRef($ref, $resolveStack = []) { @@ -156,7 +150,7 @@ public function resolveRef($ref, $resolveStack = []) } /** - * {@inheritdoc} + * @return object|string|null */ public function resolveRefSchema($refSchema, $resolveStack = []) { diff --git a/src/JsonSchema/SchemaStorageInterface.php b/src/JsonSchema/SchemaStorageInterface.php index ea26f7f4..7a765944 100644 --- a/src/JsonSchema/SchemaStorageInterface.php +++ b/src/JsonSchema/SchemaStorageInterface.php @@ -18,8 +18,7 @@ public function addSchema($id, $schema = null): void; * Returns schema for given identifier, or null if it does not exist * * @param string $id - * - * @return object + * @return object|string|false|null */ public function getSchema($id); @@ -27,8 +26,7 @@ public function getSchema($id); * Returns schema for given reference with all sub-references resolved * * @param string $ref - * - * @return object + * @return object|false */ public function resolveRef($ref); @@ -36,8 +34,7 @@ public function resolveRef($ref); * Returns schema referenced by '$ref' property * * @param mixed $refSchema - * - * @return object + * @return object|string|null */ public function resolveRefSchema($refSchema); } diff --git a/src/JsonSchema/Uri/Retrievers/AbstractRetriever.php b/src/JsonSchema/Uri/Retrievers/AbstractRetriever.php index f4ae718a..d554d682 100644 --- a/src/JsonSchema/Uri/Retrievers/AbstractRetriever.php +++ b/src/JsonSchema/Uri/Retrievers/AbstractRetriever.php @@ -21,7 +21,7 @@ abstract class AbstractRetriever implements UriRetrieverInterface /** * Media content type * - * @var string + * @var string|null */ protected $contentType; @@ -30,7 +30,7 @@ abstract class AbstractRetriever implements UriRetrieverInterface * * @see \JsonSchema\Uri\Retrievers\UriRetrieverInterface::getContentType() */ - public function getContentType() + public function getContentType(): ?string { return $this->contentType; } diff --git a/src/JsonSchema/Uri/Retrievers/Curl.php b/src/JsonSchema/Uri/Retrievers/Curl.php index 37488f66..21c9ad70 100644 --- a/src/JsonSchema/Uri/Retrievers/Curl.php +++ b/src/JsonSchema/Uri/Retrievers/Curl.php @@ -36,7 +36,7 @@ public function __construct() * * @see \JsonSchema\Uri\Retrievers\UriRetrieverInterface::retrieve() */ - public function retrieve($uri) + public function retrieve($uri): string { $ch = curl_init(); @@ -72,7 +72,7 @@ private function fetchMessageBody($response): void * * @return bool Whether the Content-Type header was found or not */ - protected function fetchContentType($response) + protected function fetchContentType($response): bool { if (0 < preg_match("/Content-Type:(\V*)/ims", $response, $match)) { $this->contentType = trim($match[1]); diff --git a/src/JsonSchema/Uri/Retrievers/FileGetContents.php b/src/JsonSchema/Uri/Retrievers/FileGetContents.php index 18fb7fcf..f77ebec2 100644 --- a/src/JsonSchema/Uri/Retrievers/FileGetContents.php +++ b/src/JsonSchema/Uri/Retrievers/FileGetContents.php @@ -27,7 +27,7 @@ class FileGetContents extends AbstractRetriever * * @see \JsonSchema\Uri\Retrievers\UriRetrieverInterface::retrieve() */ - public function retrieve($uri) + public function retrieve($uri): string { $errorMessage = null; set_error_handler(function ($errno, $errstr) use (&$errorMessage) { @@ -68,7 +68,7 @@ public function retrieve($uri) * * @return bool Whether the Content-Type header was found or not */ - private function fetchContentType(array $headers) + private function fetchContentType(array $headers): bool { foreach (array_reverse($headers) as $header) { if ($this->contentType = self::getContentTypeMatchInHeader($header)) { @@ -81,10 +81,8 @@ private function fetchContentType(array $headers) /** * @param string $header - * - * @return string|null */ - protected static function getContentTypeMatchInHeader($header) + protected static function getContentTypeMatchInHeader($header): ?string { if (0 < preg_match("/Content-Type:(\V*)/ims", $header, $match)) { return trim($match[1]); diff --git a/src/JsonSchema/Uri/Retrievers/PredefinedArray.php b/src/JsonSchema/Uri/Retrievers/PredefinedArray.php index 11693002..db279b7a 100644 --- a/src/JsonSchema/Uri/Retrievers/PredefinedArray.php +++ b/src/JsonSchema/Uri/Retrievers/PredefinedArray.php @@ -44,7 +44,7 @@ public function __construct(array $schemas, $contentType = Validator::SCHEMA_MED * * @see \JsonSchema\Uri\Retrievers\UriRetrieverInterface::retrieve() */ - public function retrieve($uri) + public function retrieve($uri): string { if (!array_key_exists($uri, $this->schemas)) { throw new \JsonSchema\Exception\ResourceNotFoundException(sprintf( diff --git a/src/JsonSchema/Uri/Retrievers/UriRetrieverInterface.php b/src/JsonSchema/Uri/Retrievers/UriRetrieverInterface.php index 99a2d9e7..07deb60f 100644 --- a/src/JsonSchema/Uri/Retrievers/UriRetrieverInterface.php +++ b/src/JsonSchema/Uri/Retrievers/UriRetrieverInterface.php @@ -24,15 +24,11 @@ interface UriRetrieverInterface * @param string $uri URI that resolves to a JSON schema * * @throws \JsonSchema\Exception\ResourceNotFoundException - * - * @return mixed string|null */ - public function retrieve($uri); + public function retrieve($uri): string; /** * Get media content type - * - * @return string */ - public function getContentType(); + public function getContentType(): ?string; } diff --git a/src/JsonSchema/Uri/UriResolver.php b/src/JsonSchema/Uri/UriResolver.php index 00a47e81..88fab217 100644 --- a/src/JsonSchema/Uri/UriResolver.php +++ b/src/JsonSchema/Uri/UriResolver.php @@ -25,10 +25,8 @@ class UriResolver implements UriResolverInterface * Parses a URI into five main components * * @param string $uri - * - * @return array */ - public function parse($uri) + public function parse($uri): array { preg_match('|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|', (string) $uri, $match); @@ -54,10 +52,8 @@ public function parse($uri) * Builds a URI based on n array with the main components * * @param array $components - * - * @return string */ - public function generate(array $components) + public function generate(array $components): string { $uri = $components['scheme'] . '://' . $components['authority'] @@ -76,7 +72,7 @@ public function generate(array $components) /** * {@inheritdoc} */ - public function resolve($uri, $baseUri = null) + public function resolve($uri, $baseUri = null): string { // treat non-uri base as local file path if ( @@ -124,7 +120,7 @@ public function resolve($uri, $baseUri = null) * * @return string Merged path */ - public static function combineRelativePathWithBasePath($relativePath, $basePath) + public static function combineRelativePathWithBasePath($relativePath, $basePath): string { $relativePath = self::normalizePath($relativePath); if (!$relativePath) { @@ -164,10 +160,8 @@ public static function combineRelativePathWithBasePath($relativePath, $basePath) * Normalizes a URI path component by removing dot-slash and double slashes * * @param string $path - * - * @return string */ - private static function normalizePath($path) + private static function normalizePath($path): string { $path = preg_replace('|((?parse($uri); diff --git a/src/JsonSchema/Uri/UriRetriever.php b/src/JsonSchema/Uri/UriRetriever.php index db287d94..85675018 100644 --- a/src/JsonSchema/Uri/UriRetriever.php +++ b/src/JsonSchema/Uri/UriRetriever.php @@ -69,20 +69,18 @@ public function addInvalidContentTypeEndpoint($endpoint): void * * @param UriRetrieverInterface $uriRetriever * @param string $uri - * - * @return bool|void */ - public function confirmMediaType($uriRetriever, $uri) + public function confirmMediaType($uriRetriever, $uri): ?bool { $contentType = $uriRetriever->getContentType(); if (is_null($contentType)) { // Well, we didn't get an invalid one - return; + return null; } if (in_array($contentType, [Validator::SCHEMA_MEDIA_TYPE, 'application/json'])) { - return; + return null; } foreach ($this->allowedInvalidContentTypeEndpoints as $endpoint) { @@ -99,10 +97,8 @@ public function confirmMediaType($uriRetriever, $uri) * * If none is specified, sets a default FileGetContents retriever and * returns that object. - * - * @return UriRetrieverInterface */ - public function getUriRetriever() + public function getUriRetriever(): UriRetrieverInterface { if (is_null($this->uriRetriever)) { $this->setUriRetriever(new FileGetContents()); @@ -125,7 +121,7 @@ public function getUriRetriever() * * @return object JSON Schema after walking down the fragment pieces */ - public function resolvePointer($jsonSchema, $uri) + public function resolvePointer($jsonSchema, $uri): object { $resolver = new UriResolver(); $parsed = $resolver->parse($uri); @@ -198,7 +194,7 @@ public function retrieve($uri, $baseUri = null, $translate = true): ?object * * @param string $fetchUri Absolute URI * - * @return object JSON schema object + * @return object|string JSON schema object */ protected function loadSchema($fetchUri) { @@ -223,11 +219,9 @@ protected function loadSchema($fetchUri) /** * Set the URI Retriever * - * @param UriRetrieverInterface $uriRetriever - * * @return $this for chaining */ - public function setUriRetriever(UriRetrieverInterface $uriRetriever) + public function setUriRetriever(UriRetrieverInterface $uriRetriever): self { $this->uriRetriever = $uriRetriever; @@ -238,10 +232,8 @@ public function setUriRetriever(UriRetrieverInterface $uriRetriever) * Parses a URI into five main components * * @param string $uri - * - * @return array */ - public function parse($uri) + public function parse($uri): array { preg_match('|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|', $uri, $match); @@ -267,12 +259,8 @@ public function parse($uri) /** * Builds a URI based on n array with the main components - * - * @param array $components - * - * @return string */ - public function generate(array $components) + public function generate(array $components): string { $uri = $components['scheme'] . '://' . $components['authority'] @@ -294,10 +282,8 @@ public function generate(array $components) * * @param string $uri Absolute or relative * @param string $baseUri Optional base URI - * - * @return string */ - public function resolve($uri, $baseUri = null) + public function resolve($uri, $baseUri = null): string { $components = $this->parse($uri); $path = $components['path']; diff --git a/src/JsonSchema/UriResolverInterface.php b/src/JsonSchema/UriResolverInterface.php index e80e2be7..3b37b70c 100644 --- a/src/JsonSchema/UriResolverInterface.php +++ b/src/JsonSchema/UriResolverInterface.php @@ -24,5 +24,5 @@ interface UriResolverInterface * * @return string Absolute URI */ - public function resolve($uri, $baseUri = null); + public function resolve($uri, $baseUri = null): string; } From 4b1419a9d6056eaf7aa7a04c7689eb8980c8eb96 Mon Sep 17 00:00:00 2001 From: Jack Worman Date: Fri, 21 Feb 2025 08:26:29 -0500 Subject: [PATCH 4/7] Add-return-types --- phpstan-baseline.neon | 1350 ++++++++++++++++- phpstan.neon | 1 + .../Constraints/UndefinedConstraint.php | 4 - .../Uri/Retrievers/PredefinedArray.php | 3 - src/JsonSchema/Uri/UriResolver.php | 2 - 5 files changed, 1326 insertions(+), 34 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index efb75fbb..535cbdd7 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -600,6 +600,11 @@ parameters: count: 3 path: src/JsonSchema/Constraints/UndefinedConstraint.php + - + message: "#^Cannot access property \\$default on object\\|string\\|null\\.$#" + count: 6 + path: src/JsonSchema/Constraints/UndefinedConstraint.php + - message: "#^Cannot access property \\$dependencies on mixed\\.$#" count: 1 @@ -675,6 +680,11 @@ parameters: count: 1 path: src/JsonSchema/Constraints/UndefinedConstraint.php + - + message: "#^Parameter \\#1 \\$object_or_class of function property_exists expects object\\|string, object\\|string\\|null given\\.$#" + count: 2 + path: src/JsonSchema/Constraints/UndefinedConstraint.php + - message: "#^Parameter \\#1 \\$var of function count expects array\\|Countable, mixed given\\.$#" count: 3 @@ -771,7 +781,7 @@ parameters: path: src/JsonSchema/SchemaStorage.php - - message: "#^Call to function is_array\\(\\) with object will always evaluate to false\\.$#" + message: "#^Call to function is_array\\(\\) with object\\|string\\|false\\|null will always evaluate to false\\.$#" count: 1 path: src/JsonSchema/SchemaStorage.php @@ -781,47 +791,47 @@ parameters: path: src/JsonSchema/SchemaStorage.php - - message: "#^Method JsonSchema\\\\SchemaStorage\\:\\:resolveRefSchema\\(\\) has parameter \\$resolveStack with no type specified\\.$#" + message: "#^Method JsonSchema\\\\SchemaStorage\\:\\:resolveRef\\(\\) should return object\\|false but returns object\\|string\\|false\\|null\\.$#" count: 1 path: src/JsonSchema/SchemaStorage.php - - message: "#^Method JsonSchema\\\\SchemaStorage\\:\\:resolveRefSchema\\(\\) should return object but returns mixed\\.$#" + message: "#^Method JsonSchema\\\\SchemaStorage\\:\\:resolveRefSchema\\(\\) has parameter \\$resolveStack with no type specified\\.$#" count: 1 path: src/JsonSchema/SchemaStorage.php - - message: "#^Property JsonSchema\\\\SchemaStorage\\:\\:\\$schemas has no type specified\\.$#" + message: "#^Method JsonSchema\\\\SchemaStorage\\:\\:resolveRefSchema\\(\\) should return object\\|string\\|null but returns mixed\\.$#" count: 1 path: src/JsonSchema/SchemaStorage.php - - message: "#^Property JsonSchema\\\\SchemaStorage\\:\\:\\$uriResolver has no type specified\\.$#" + message: "#^Method JsonSchema\\\\SchemaStorage\\:\\:resolveRefSchema\\(\\) should return object\\|string\\|null but returns object\\|false\\.$#" count: 1 path: src/JsonSchema/SchemaStorage.php - - message: "#^Property JsonSchema\\\\SchemaStorage\\:\\:\\$uriRetriever has no type specified\\.$#" + message: "#^Property JsonSchema\\\\SchemaStorage\\:\\:\\$schemas has no type specified\\.$#" count: 1 path: src/JsonSchema/SchemaStorage.php - - message: "#^Result of && is always false\\.$#" + message: "#^Property JsonSchema\\\\SchemaStorage\\:\\:\\$uriResolver has no type specified\\.$#" count: 1 path: src/JsonSchema/SchemaStorage.php - - message: "#^Offset 1 does not exist on array\\{0\\?\\: string, 1\\?\\: string\\}\\.$#" + message: "#^Property JsonSchema\\\\SchemaStorage\\:\\:\\$uriRetriever has no type specified\\.$#" count: 1 - path: src/JsonSchema/Uri/Retrievers/Curl.php + path: src/JsonSchema/SchemaStorage.php - - message: "#^Parameter \\#1 \\$response of method JsonSchema\\\\Uri\\\\Retrievers\\\\Curl\\:\\:fetchContentType\\(\\) expects string, string\\|true given\\.$#" + message: "#^Result of && is always false\\.$#" count: 1 - path: src/JsonSchema/Uri/Retrievers/Curl.php + path: src/JsonSchema/SchemaStorage.php - - message: "#^Parameter \\#1 \\$response of method JsonSchema\\\\Uri\\\\Retrievers\\\\Curl\\:\\:fetchMessageBody\\(\\) expects string, string\\|true given\\.$#" + message: "#^Offset 1 does not exist on array\\{0\\?\\: string, 1\\?\\: string\\}\\.$#" count: 1 path: src/JsonSchema/Uri/Retrievers/Curl.php @@ -840,16 +850,6 @@ parameters: count: 1 path: src/JsonSchema/Uri/Retrievers/FileGetContents.php - - - message: "#^Property JsonSchema\\\\Uri\\\\Retrievers\\\\AbstractRetriever\\:\\:\\$contentType \\(string\\) does not accept null\\.$#" - count: 1 - path: src/JsonSchema/Uri/Retrievers/FileGetContents.php - - - - message: "#^Property JsonSchema\\\\Uri\\\\Retrievers\\\\AbstractRetriever\\:\\:\\$contentType \\(string\\) does not accept string\\|null\\.$#" - count: 1 - path: src/JsonSchema/Uri/Retrievers/FileGetContents.php - - message: "#^Property JsonSchema\\\\Uri\\\\Retrievers\\\\FileGetContents\\:\\:\\$messageBody has no type specified\\.$#" count: 1 @@ -897,7 +897,7 @@ parameters: - message: "#^Call to function is_null\\(\\) with string will always evaluate to false\\.$#" - count: 2 + count: 1 path: src/JsonSchema/Uri/UriRetriever.php - @@ -916,7 +916,7 @@ parameters: path: src/JsonSchema/Uri/UriRetriever.php - - message: "#^Method JsonSchema\\\\Uri\\\\UriRetriever\\:\\:loadSchema\\(\\) should return object but returns mixed\\.$#" + message: "#^Method JsonSchema\\\\Uri\\\\UriRetriever\\:\\:loadSchema\\(\\) should return object\\|string but returns mixed\\.$#" count: 1 path: src/JsonSchema/Uri/UriRetriever.php @@ -946,7 +946,7 @@ parameters: path: src/JsonSchema/Uri/UriRetriever.php - - message: "#^Parameter \\#1 \\$json of function json_decode expects string, mixed given\\.$#" + message: "#^Parameter \\#1 \\$jsonSchema of method JsonSchema\\\\Uri\\\\UriRetriever\\:\\:resolvePointer\\(\\) expects object, object\\|string given\\.$#" count: 1 path: src/JsonSchema/Uri/UriRetriever.php @@ -995,3 +995,1303 @@ parameters: count: 1 path: src/JsonSchema/Validator.php + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\AdditionalPropertiesTest\\:\\:getInvalidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/AdditionalPropertiesTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\AdditionalPropertiesTest\\:\\:getValidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/AdditionalPropertiesTest.php + + - + message: "#^Property JsonSchema\\\\Tests\\\\Constraints\\\\AdditionalPropertiesTest\\:\\:\\$validateSchema has no type specified\\.$#" + count: 1 + path: tests/Constraints/AdditionalPropertiesTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\ArraysTest\\:\\:getInvalidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/ArraysTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\ArraysTest\\:\\:getValidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/ArraysTest.php + + - + message: "#^Property JsonSchema\\\\Tests\\\\Constraints\\\\ArraysTest\\:\\:\\$validateSchema has no type specified\\.$#" + count: 1 + path: tests/Constraints/ArraysTest.php + + - + message: "#^Access to an undefined property object\\:\\:\\$\\$schema\\.$#" + count: 4 + path: tests/Constraints/BaseTestCase.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\BaseTestCase\\:\\:getInvalidForAssocTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/BaseTestCase.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\BaseTestCase\\:\\:getInvalidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/BaseTestCase.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\BaseTestCase\\:\\:getValidForAssocTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/BaseTestCase.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\BaseTestCase\\:\\:getValidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/BaseTestCase.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\BaseTestCase\\:\\:testInvalidCases\\(\\) has parameter \\$checkMode with no type specified\\.$#" + count: 1 + path: tests/Constraints/BaseTestCase.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\BaseTestCase\\:\\:testInvalidCases\\(\\) has parameter \\$errors with no type specified\\.$#" + count: 1 + path: tests/Constraints/BaseTestCase.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\BaseTestCase\\:\\:testInvalidCases\\(\\) has parameter \\$input with no type specified\\.$#" + count: 1 + path: tests/Constraints/BaseTestCase.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\BaseTestCase\\:\\:testInvalidCases\\(\\) has parameter \\$schema with no type specified\\.$#" + count: 1 + path: tests/Constraints/BaseTestCase.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\BaseTestCase\\:\\:testInvalidCasesUsingAssoc\\(\\) has parameter \\$checkMode with no type specified\\.$#" + count: 1 + path: tests/Constraints/BaseTestCase.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\BaseTestCase\\:\\:testInvalidCasesUsingAssoc\\(\\) has parameter \\$errors with no type specified\\.$#" + count: 1 + path: tests/Constraints/BaseTestCase.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\BaseTestCase\\:\\:testInvalidCasesUsingAssoc\\(\\) has parameter \\$input with no type specified\\.$#" + count: 1 + path: tests/Constraints/BaseTestCase.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\BaseTestCase\\:\\:testInvalidCasesUsingAssoc\\(\\) has parameter \\$schema with no type specified\\.$#" + count: 1 + path: tests/Constraints/BaseTestCase.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\BaseTestCase\\:\\:testValidCases\\(\\) has parameter \\$checkMode with no type specified\\.$#" + count: 1 + path: tests/Constraints/BaseTestCase.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\BaseTestCase\\:\\:testValidCases\\(\\) has parameter \\$input with no type specified\\.$#" + count: 1 + path: tests/Constraints/BaseTestCase.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\BaseTestCase\\:\\:testValidCases\\(\\) has parameter \\$schema with no type specified\\.$#" + count: 1 + path: tests/Constraints/BaseTestCase.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\BaseTestCase\\:\\:testValidCasesUsingAssoc\\(\\) has parameter \\$checkMode with no type specified\\.$#" + count: 1 + path: tests/Constraints/BaseTestCase.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\BaseTestCase\\:\\:testValidCasesUsingAssoc\\(\\) has parameter \\$input with no type specified\\.$#" + count: 1 + path: tests/Constraints/BaseTestCase.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\BaseTestCase\\:\\:testValidCasesUsingAssoc\\(\\) has parameter \\$schema with no type specified\\.$#" + count: 1 + path: tests/Constraints/BaseTestCase.php + + - + message: "#^Parameter \\#1 \\$schema of method JsonSchema\\\\Tests\\\\Constraints\\\\VeryBaseTestCase\\:\\:getUriRetrieverMock\\(\\) expects object\\|null, mixed given\\.$#" + count: 4 + path: tests/Constraints/BaseTestCase.php + + - + message: "#^Parameter \\#1 \\$uriRetriever of class JsonSchema\\\\SchemaStorage constructor expects JsonSchema\\\\UriRetrieverInterface\\|null, object given\\.$#" + count: 4 + path: tests/Constraints/BaseTestCase.php + + - + message: "#^Property JsonSchema\\\\Tests\\\\Constraints\\\\BaseTestCase\\:\\:\\$schemaSpec has no type specified\\.$#" + count: 1 + path: tests/Constraints/BaseTestCase.php + + - + message: "#^Property JsonSchema\\\\Tests\\\\Constraints\\\\BaseTestCase\\:\\:\\$validateSchema has no type specified\\.$#" + count: 1 + path: tests/Constraints/BaseTestCase.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\BasicTypesTest\\:\\:getInvalidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/BasicTypesTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\BasicTypesTest\\:\\:getValidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/BasicTypesTest.php + + - + message: "#^Property JsonSchema\\\\Tests\\\\Constraints\\\\BasicTypesTest\\:\\:\\$schemaSpec has no type specified\\.$#" + count: 1 + path: tests/Constraints/BasicTypesTest.php + + - + message: "#^Property JsonSchema\\\\Tests\\\\Constraints\\\\BasicTypesTest\\:\\:\\$validateSchema has no type specified\\.$#" + count: 1 + path: tests/Constraints/BasicTypesTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\CoerciveTest\\:\\:dataCoerceCases\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/CoerciveTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\CoerciveTest\\:\\:testCoerceCases\\(\\) has parameter \\$assoc with no type specified\\.$#" + count: 1 + path: tests/Constraints/CoerciveTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\CoerciveTest\\:\\:testCoerceCases\\(\\) has parameter \\$data with no type specified\\.$#" + count: 1 + path: tests/Constraints/CoerciveTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\CoerciveTest\\:\\:testCoerceCases\\(\\) has parameter \\$endType with no type specified\\.$#" + count: 1 + path: tests/Constraints/CoerciveTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\CoerciveTest\\:\\:testCoerceCases\\(\\) has parameter \\$endValue with no type specified\\.$#" + count: 1 + path: tests/Constraints/CoerciveTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\CoerciveTest\\:\\:testCoerceCases\\(\\) has parameter \\$extraFlags with no type specified\\.$#" + count: 1 + path: tests/Constraints/CoerciveTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\CoerciveTest\\:\\:testCoerceCases\\(\\) has parameter \\$schema with no type specified\\.$#" + count: 1 + path: tests/Constraints/CoerciveTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\CoerciveTest\\:\\:testCoerceCases\\(\\) has parameter \\$startType with no type specified\\.$#" + count: 1 + path: tests/Constraints/CoerciveTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\CoerciveTest\\:\\:testCoerceCases\\(\\) has parameter \\$valid with no type specified\\.$#" + count: 1 + path: tests/Constraints/CoerciveTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\CoerciveTest\\:\\:testCoerceCasesUsingAssoc\\(\\) has parameter \\$data with no type specified\\.$#" + count: 1 + path: tests/Constraints/CoerciveTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\CoerciveTest\\:\\:testCoerceCasesUsingAssoc\\(\\) has parameter \\$early with no type specified\\.$#" + count: 1 + path: tests/Constraints/CoerciveTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\CoerciveTest\\:\\:testCoerceCasesUsingAssoc\\(\\) has parameter \\$endType with no type specified\\.$#" + count: 1 + path: tests/Constraints/CoerciveTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\CoerciveTest\\:\\:testCoerceCasesUsingAssoc\\(\\) has parameter \\$endValue with no type specified\\.$#" + count: 1 + path: tests/Constraints/CoerciveTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\CoerciveTest\\:\\:testCoerceCasesUsingAssoc\\(\\) has parameter \\$schema with no type specified\\.$#" + count: 1 + path: tests/Constraints/CoerciveTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\CoerciveTest\\:\\:testCoerceCasesUsingAssoc\\(\\) has parameter \\$startType with no type specified\\.$#" + count: 1 + path: tests/Constraints/CoerciveTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\CoerciveTest\\:\\:testCoerceCasesUsingAssoc\\(\\) has parameter \\$valid with no type specified\\.$#" + count: 1 + path: tests/Constraints/CoerciveTest.php + + - + message: "#^Parameter \\#3 \\$checkMode of method JsonSchema\\\\Validator\\:\\:validate\\(\\) expects int\\<0, 511\\>\\|null, int given\\.$#" + count: 1 + path: tests/Constraints/CoerciveTest.php + + - + message: "#^Property JsonSchema\\\\Tests\\\\Constraints\\\\CoerciveTest\\:\\:\\$factory has no type specified\\.$#" + count: 1 + path: tests/Constraints/CoerciveTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\ConstTest\\:\\:getInvalidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/ConstTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\ConstTest\\:\\:getValidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/ConstTest.php + + - + message: "#^Property JsonSchema\\\\Tests\\\\Constraints\\\\ConstTest\\:\\:\\$schemaSpec has no type specified\\.$#" + count: 1 + path: tests/Constraints/ConstTest.php + + - + message: "#^Property JsonSchema\\\\Tests\\\\Constraints\\\\ConstTest\\:\\:\\$validateSchema has no type specified\\.$#" + count: 1 + path: tests/Constraints/ConstTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\DefaultPropertiesTest\\:\\:getValidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/DefaultPropertiesTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\DefaultPropertiesTest\\:\\:testValidCases\\(\\) has parameter \\$checkMode with no type specified\\.$#" + count: 1 + path: tests/Constraints/DefaultPropertiesTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\DefaultPropertiesTest\\:\\:testValidCases\\(\\) has parameter \\$expectOutput with no type specified\\.$#" + count: 1 + path: tests/Constraints/DefaultPropertiesTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\DefaultPropertiesTest\\:\\:testValidCases\\(\\) has parameter \\$input with no type specified\\.$#" + count: 1 + path: tests/Constraints/DefaultPropertiesTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\DefaultPropertiesTest\\:\\:testValidCases\\(\\) has parameter \\$schema with no type specified\\.$#" + count: 1 + path: tests/Constraints/DefaultPropertiesTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\DefaultPropertiesTest\\:\\:testValidCasesUsingAssoc\\(\\) has parameter \\$checkMode with no type specified\\.$#" + count: 1 + path: tests/Constraints/DefaultPropertiesTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\DefaultPropertiesTest\\:\\:testValidCasesUsingAssoc\\(\\) has parameter \\$expectOutput with no type specified\\.$#" + count: 1 + path: tests/Constraints/DefaultPropertiesTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\DefaultPropertiesTest\\:\\:testValidCasesUsingAssoc\\(\\) has parameter \\$input with no type specified\\.$#" + count: 1 + path: tests/Constraints/DefaultPropertiesTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\DefaultPropertiesTest\\:\\:testValidCasesUsingAssoc\\(\\) has parameter \\$schema with no type specified\\.$#" + count: 1 + path: tests/Constraints/DefaultPropertiesTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\DefaultPropertiesTest\\:\\:testValidCasesUsingAssocWithoutTypeCast\\(\\) has parameter \\$checkMode with no type specified\\.$#" + count: 1 + path: tests/Constraints/DefaultPropertiesTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\DefaultPropertiesTest\\:\\:testValidCasesUsingAssocWithoutTypeCast\\(\\) has parameter \\$expectOutput with no type specified\\.$#" + count: 1 + path: tests/Constraints/DefaultPropertiesTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\DefaultPropertiesTest\\:\\:testValidCasesUsingAssocWithoutTypeCast\\(\\) has parameter \\$input with no type specified\\.$#" + count: 1 + path: tests/Constraints/DefaultPropertiesTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\DefaultPropertiesTest\\:\\:testValidCasesUsingAssocWithoutTypeCast\\(\\) has parameter \\$schema with no type specified\\.$#" + count: 1 + path: tests/Constraints/DefaultPropertiesTest.php + + - + message: "#^Parameter \\#2 \\$schema of method JsonSchema\\\\SchemaStorage\\:\\:addSchema\\(\\) expects object\\|null, mixed given\\.$#" + count: 1 + path: tests/Constraints/DefaultPropertiesTest.php + + - + message: "#^Parameter \\#3 \\$checkMode of method JsonSchema\\\\Validator\\:\\:validate\\(\\) expects int\\<0, 511\\>\\|null, int given\\.$#" + count: 1 + path: tests/Constraints/DefaultPropertiesTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\DependenciesTest\\:\\:getInvalidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/DependenciesTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\DependenciesTest\\:\\:getValidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/DependenciesTest.php + + - + message: "#^Property JsonSchema\\\\Tests\\\\Constraints\\\\DependenciesTest\\:\\:\\$schemaSpec has no type specified\\.$#" + count: 1 + path: tests/Constraints/DependenciesTest.php + + - + message: "#^Property JsonSchema\\\\Tests\\\\Constraints\\\\DependenciesTest\\:\\:\\$validateSchema has no type specified\\.$#" + count: 1 + path: tests/Constraints/DependenciesTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\DisallowTest\\:\\:getInvalidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/DisallowTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\DisallowTest\\:\\:getValidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/DisallowTest.php + + - + message: "#^Property JsonSchema\\\\Tests\\\\Constraints\\\\DisallowTest\\:\\:\\$schemaSpec has no type specified\\.$#" + count: 1 + path: tests/Constraints/DisallowTest.php + + - + message: "#^Property JsonSchema\\\\Tests\\\\Constraints\\\\DisallowTest\\:\\:\\$validateSchema has no type specified\\.$#" + count: 1 + path: tests/Constraints/DisallowTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\DivisibleByTest\\:\\:getInvalidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/DivisibleByTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\DivisibleByTest\\:\\:getValidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/DivisibleByTest.php + + - + message: "#^Property JsonSchema\\\\Tests\\\\Constraints\\\\DivisibleByTest\\:\\:\\$validateSchema has no type specified\\.$#" + count: 1 + path: tests/Constraints/DivisibleByTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\EnumTest\\:\\:getInvalidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/EnumTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\EnumTest\\:\\:getValidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/EnumTest.php + + - + message: "#^Property JsonSchema\\\\Tests\\\\Constraints\\\\EnumTest\\:\\:\\$schemaSpec has no type specified\\.$#" + count: 1 + path: tests/Constraints/EnumTest.php + + - + message: "#^Property JsonSchema\\\\Tests\\\\Constraints\\\\EnumTest\\:\\:\\$validateSchema has no type specified\\.$#" + count: 1 + path: tests/Constraints/EnumTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\ExtendsTest\\:\\:getInvalidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/ExtendsTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\ExtendsTest\\:\\:getValidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/ExtendsTest.php + + - + message: "#^Property JsonSchema\\\\Tests\\\\Constraints\\\\ExtendsTest\\:\\:\\$schemaSpec has no type specified\\.$#" + count: 1 + path: tests/Constraints/ExtendsTest.php + + - + message: "#^Property JsonSchema\\\\Tests\\\\Constraints\\\\ExtendsTest\\:\\:\\$validateSchema has no type specified\\.$#" + count: 1 + path: tests/Constraints/ExtendsTest.php + + - + message: "#^Parameter \\#1 \\$expected of method PHPUnit\\\\Framework\\\\Assert\\:\\:assertInstanceOf\\(\\) expects class\\-string\\, string given\\.$#" + count: 1 + path: tests/Constraints/FactoryTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\FormatTest\\:\\:getInvalidFormats\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/FormatTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\FormatTest\\:\\:getInvalidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/FormatTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\FormatTest\\:\\:getValidFormats\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/FormatTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\FormatTest\\:\\:getValidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/FormatTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\FormatTest\\:\\:testDisabledFormat\\(\\) has parameter \\$format with no type specified\\.$#" + count: 1 + path: tests/Constraints/FormatTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\FormatTest\\:\\:testDisabledFormat\\(\\) has parameter \\$string with no type specified\\.$#" + count: 1 + path: tests/Constraints/FormatTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\FormatTest\\:\\:testInvalidFormat\\(\\) has parameter \\$format with no type specified\\.$#" + count: 1 + path: tests/Constraints/FormatTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\FormatTest\\:\\:testInvalidFormat\\(\\) has parameter \\$string with no type specified\\.$#" + count: 1 + path: tests/Constraints/FormatTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\FormatTest\\:\\:testValidFormat\\(\\) has parameter \\$format with no type specified\\.$#" + count: 1 + path: tests/Constraints/FormatTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\FormatTest\\:\\:testValidFormat\\(\\) has parameter \\$string with no type specified\\.$#" + count: 1 + path: tests/Constraints/FormatTest.php + + - + message: "#^Property JsonSchema\\\\Tests\\\\Constraints\\\\FormatTest\\:\\:\\$validateSchema has no type specified\\.$#" + count: 1 + path: tests/Constraints/FormatTest.php + + - + message: "#^Parameter \\#1 \\$json of function json_decode expects string, string\\|false given\\.$#" + count: 3 + path: tests/Constraints/LongArraysTest.php + + - + message: "#^Parameter \\#1 \\$uriRetriever of class JsonSchema\\\\SchemaStorage constructor expects JsonSchema\\\\UriRetrieverInterface\\|null, object given\\.$#" + count: 3 + path: tests/Constraints/LongArraysTest.php + + - + message: "#^Property JsonSchema\\\\Tests\\\\Constraints\\\\LongArraysTest\\:\\:\\$validateSchema has no type specified\\.$#" + count: 1 + path: tests/Constraints/LongArraysTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\MinItemsMaxItemsTest\\:\\:getInvalidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/MinItemsMaxItemsTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\MinItemsMaxItemsTest\\:\\:getValidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/MinItemsMaxItemsTest.php + + - + message: "#^Property JsonSchema\\\\Tests\\\\Constraints\\\\MinItemsMaxItemsTest\\:\\:\\$validateSchema has no type specified\\.$#" + count: 1 + path: tests/Constraints/MinItemsMaxItemsTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\MinLengthMaxLengthMultiByteTest\\:\\:getInvalidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/MinLengthMaxLengthMultiByteTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\MinLengthMaxLengthMultiByteTest\\:\\:getValidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/MinLengthMaxLengthMultiByteTest.php + + - + message: "#^Property JsonSchema\\\\Tests\\\\Constraints\\\\MinLengthMaxLengthMultiByteTest\\:\\:\\$validateSchema has no type specified\\.$#" + count: 1 + path: tests/Constraints/MinLengthMaxLengthMultiByteTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\MinLengthMaxLengthTest\\:\\:getInvalidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/MinLengthMaxLengthTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\MinLengthMaxLengthTest\\:\\:getValidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/MinLengthMaxLengthTest.php + + - + message: "#^Property JsonSchema\\\\Tests\\\\Constraints\\\\MinLengthMaxLengthTest\\:\\:\\$validateSchema has no type specified\\.$#" + count: 1 + path: tests/Constraints/MinLengthMaxLengthTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\MinMaxPropertiesTest\\:\\:getInvalidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/MinMaxPropertiesTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\MinMaxPropertiesTest\\:\\:getValidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/MinMaxPropertiesTest.php + + - + message: "#^Property JsonSchema\\\\Tests\\\\Constraints\\\\MinMaxPropertiesTest\\:\\:\\$validateSchema has no type specified\\.$#" + count: 1 + path: tests/Constraints/MinMaxPropertiesTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\MinimumMaximumTest\\:\\:getInvalidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/MinimumMaximumTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\MinimumMaximumTest\\:\\:getValidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/MinimumMaximumTest.php + + - + message: "#^Property JsonSchema\\\\Tests\\\\Constraints\\\\MinimumMaximumTest\\:\\:\\$validateSchema has no type specified\\.$#" + count: 1 + path: tests/Constraints/MinimumMaximumTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\NotTest\\:\\:getInvalidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/NotTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\NotTest\\:\\:getValidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/NotTest.php + + - + message: "#^Property JsonSchema\\\\Tests\\\\Constraints\\\\NotTest\\:\\:\\$validateSchema has no type specified\\.$#" + count: 1 + path: tests/Constraints/NotTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\NumberAndIntegerTypesTest\\:\\:getInvalidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/NumberAndIntegerTypesTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\NumberAndIntegerTypesTest\\:\\:getValidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/NumberAndIntegerTypesTest.php + + - + message: "#^Property JsonSchema\\\\Tests\\\\Constraints\\\\NumberAndIntegerTypesTest\\:\\:\\$validateSchema has no type specified\\.$#" + count: 1 + path: tests/Constraints/NumberAndIntegerTypesTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\OfPropertiesTest\\:\\:getInvalidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/OfPropertiesTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\OfPropertiesTest\\:\\:getValidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/OfPropertiesTest.php + + - + message: "#^Property JsonSchema\\\\Tests\\\\Constraints\\\\OfPropertiesTest\\:\\:\\$validateSchema has no type specified\\.$#" + count: 1 + path: tests/Constraints/OfPropertiesTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\PatternPropertiesTest\\:\\:getInvalidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/PatternPropertiesTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\PatternPropertiesTest\\:\\:getValidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/PatternPropertiesTest.php + + - + message: "#^Property JsonSchema\\\\Tests\\\\Constraints\\\\PatternPropertiesTest\\:\\:\\$validateSchema has no type specified\\.$#" + count: 1 + path: tests/Constraints/PatternPropertiesTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\PatternTest\\:\\:getInvalidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/PatternTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\PatternTest\\:\\:getValidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/PatternTest.php + + - + message: "#^Property JsonSchema\\\\Tests\\\\Constraints\\\\PatternTest\\:\\:\\$validateSchema has no type specified\\.$#" + count: 1 + path: tests/Constraints/PatternTest.php + + - + message: "#^Parameter \\#1 \\$json of function json_decode expects string, string\\|false given\\.$#" + count: 2 + path: tests/Constraints/PointerTest.php + + - + message: "#^Property JsonSchema\\\\Tests\\\\Constraints\\\\PointerTest\\:\\:\\$validateSchema has no type specified\\.$#" + count: 1 + path: tests/Constraints/PointerTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\ReadOnlyTest\\:\\:getInvalidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/ReadOnlyTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\ReadOnlyTest\\:\\:getValidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/ReadOnlyTest.php + + - + message: "#^Property JsonSchema\\\\Tests\\\\Constraints\\\\ReadOnlyTest\\:\\:\\$validateSchema has no type specified\\.$#" + count: 1 + path: tests/Constraints/ReadOnlyTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\RequireTest\\:\\:getInvalidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/RequireTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\RequireTest\\:\\:getValidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/RequireTest.php + + - + message: "#^Property JsonSchema\\\\Tests\\\\Constraints\\\\RequireTest\\:\\:\\$validateSchema has no type specified\\.$#" + count: 1 + path: tests/Constraints/RequireTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\RequiredPropertyTest\\:\\:assertErrorHasExpectedPropertyValue\\(\\) has parameter \\$error with no type specified\\.$#" + count: 1 + path: tests/Constraints/RequiredPropertyTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\RequiredPropertyTest\\:\\:assertErrorHasExpectedPropertyValue\\(\\) has parameter \\$propertyValue with no type specified\\.$#" + count: 1 + path: tests/Constraints/RequiredPropertyTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\RequiredPropertyTest\\:\\:getInvalidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/RequiredPropertyTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\RequiredPropertyTest\\:\\:getValidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/RequiredPropertyTest.php + + - + message: "#^Property JsonSchema\\\\Tests\\\\Constraints\\\\RequiredPropertyTest\\:\\:\\$schemaSpec has no type specified\\.$#" + count: 1 + path: tests/Constraints/RequiredPropertyTest.php + + - + message: "#^Property JsonSchema\\\\Tests\\\\Constraints\\\\RequiredPropertyTest\\:\\:\\$validateSchema has no type specified\\.$#" + count: 1 + path: tests/Constraints/RequiredPropertyTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\SchemaValidationTest\\:\\:getInvalidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/SchemaValidationTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\SchemaValidationTest\\:\\:getValidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/SchemaValidationTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\SchemaValidationTest\\:\\:testInvalidCases\\(\\) has parameter \\$schema with no type specified\\.$#" + count: 1 + path: tests/Constraints/SchemaValidationTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\SchemaValidationTest\\:\\:testValidCases\\(\\) has parameter \\$schema with no type specified\\.$#" + count: 1 + path: tests/Constraints/SchemaValidationTest.php + + - + message: "#^Property JsonSchema\\\\Tests\\\\Constraints\\\\SchemaValidationTest\\:\\:\\$validateSchema has no type specified\\.$#" + count: 1 + path: tests/Constraints/SchemaValidationTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\SelfDefinedSchemaTest\\:\\:getInvalidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/SelfDefinedSchemaTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\SelfDefinedSchemaTest\\:\\:getValidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/SelfDefinedSchemaTest.php + + - + message: "#^Property JsonSchema\\\\Tests\\\\Constraints\\\\SelfDefinedSchemaTest\\:\\:\\$validateSchema has no type specified\\.$#" + count: 1 + path: tests/Constraints/SelfDefinedSchemaTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\TupleTypingTest\\:\\:getInvalidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/TupleTypingTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\TupleTypingTest\\:\\:getValidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/TupleTypingTest.php + + - + message: "#^Property JsonSchema\\\\Tests\\\\Constraints\\\\TupleTypingTest\\:\\:\\$validateSchema has no type specified\\.$#" + count: 1 + path: tests/Constraints/TupleTypingTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\TypeTest\\:\\:provideIndefiniteArticlesForTypes\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/TypeTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\TypeTest\\:\\:testIndefiniteArticleForTypeInTypeCheckErrorMessage\\(\\) has parameter \\$label with no type specified\\.$#" + count: 1 + path: tests/Constraints/TypeTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\TypeTest\\:\\:testIndefiniteArticleForTypeInTypeCheckErrorMessage\\(\\) has parameter \\$type with no type specified\\.$#" + count: 1 + path: tests/Constraints/TypeTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\TypeTest\\:\\:testIndefiniteArticleForTypeInTypeCheckErrorMessage\\(\\) has parameter \\$value with no type specified\\.$#" + count: 1 + path: tests/Constraints/TypeTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\TypeTest\\:\\:testIndefiniteArticleForTypeInTypeCheckErrorMessage\\(\\) has parameter \\$wording with no type specified\\.$#" + count: 1 + path: tests/Constraints/TypeTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\TypeTest\\:\\:testValidateTypeNameWording\\(\\) has parameter \\$nameWording with no type specified\\.$#" + count: 1 + path: tests/Constraints/TypeTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\TypeTest\\:\\:validNameWordingDataProvider\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/TypeTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\UnionTypesTest\\:\\:getInvalidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/UnionTypesTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\UnionTypesTest\\:\\:getValidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/UnionTypesTest.php + + - + message: "#^Property JsonSchema\\\\Tests\\\\Constraints\\\\UnionTypesTest\\:\\:\\$validateSchema has no type specified\\.$#" + count: 1 + path: tests/Constraints/UnionTypesTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\UnionWithNullValueTest\\:\\:getInvalidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/UnionWithNullValueTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\UnionWithNullValueTest\\:\\:getValidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/UnionWithNullValueTest.php + + - + message: "#^Property JsonSchema\\\\Tests\\\\Constraints\\\\UnionWithNullValueTest\\:\\:\\$validateSchema has no type specified\\.$#" + count: 1 + path: tests/Constraints/UnionWithNullValueTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\UniqueItemsTest\\:\\:getInvalidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/UniqueItemsTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\UniqueItemsTest\\:\\:getValidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/UniqueItemsTest.php + + - + message: "#^Property JsonSchema\\\\Tests\\\\Constraints\\\\UniqueItemsTest\\:\\:\\$validateSchema has no type specified\\.$#" + count: 1 + path: tests/Constraints/UniqueItemsTest.php + + - + message: "#^Call to an undefined method Prophecy\\\\Prophecy\\\\ObjectProphecy\\:\\:retrieve\\(\\)\\.$#" + count: 2 + path: tests/Constraints/VeryBaseTestCase.php + + - + message: "#^Cannot access offset 'path' on array\\{scheme\\?\\: string, host\\?\\: string, port\\?\\: int\\<0, 65535\\>, user\\?\\: string, pass\\?\\: string, path\\?\\: string, query\\?\\: string, fragment\\?\\: string\\}\\|false\\.$#" + count: 2 + path: tests/Constraints/VeryBaseTestCase.php + + - + message: "#^Negated boolean expression is always false\\.$#" + count: 2 + path: tests/Constraints/VeryBaseTestCase.php + + - + message: "#^Parameter \\#1 \\$json of function json_decode expects string, string\\|false given\\.$#" + count: 4 + path: tests/Constraints/VeryBaseTestCase.php + + - + message: "#^Property JsonSchema\\\\Tests\\\\Constraints\\\\VeryBaseTestCase\\:\\:\\$jsonSchemaDraft03 \\(object\\) does not accept mixed\\.$#" + count: 1 + path: tests/Constraints/VeryBaseTestCase.php + + - + message: "#^Property JsonSchema\\\\Tests\\\\Constraints\\\\VeryBaseTestCase\\:\\:\\$jsonSchemaDraft04 \\(object\\) does not accept mixed\\.$#" + count: 1 + path: tests/Constraints/VeryBaseTestCase.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\WrongMessagesFailingTestCaseTest\\:\\:getInvalidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/WrongMessagesFailingTestCaseTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Constraints\\\\WrongMessagesFailingTestCaseTest\\:\\:getValidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Constraints/WrongMessagesFailingTestCaseTest.php + + - + message: "#^Property JsonSchema\\\\Tests\\\\Constraints\\\\WrongMessagesFailingTestCaseTest\\:\\:\\$validateSchema has no type specified\\.$#" + count: 1 + path: tests/Constraints/WrongMessagesFailingTestCaseTest.php + + - + message: "#^Argument of an invalid type array\\\\|false supplied for foreach, only iterables are supported\\.$#" + count: 1 + path: tests/Drafts/BaseDraftTestCase.php + + - + message: "#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#" + count: 1 + path: tests/Drafts/BaseDraftTestCase.php + + - + message: "#^Cannot access property \\$description on mixed\\.$#" + count: 1 + path: tests/Drafts/BaseDraftTestCase.php + + - + message: "#^Cannot access property \\$schema on mixed\\.$#" + count: 1 + path: tests/Drafts/BaseDraftTestCase.php + + - + message: "#^Cannot access property \\$tests on mixed\\.$#" + count: 1 + path: tests/Drafts/BaseDraftTestCase.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Drafts\\\\BaseDraftTestCase\\:\\:getInvalidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Drafts/BaseDraftTestCase.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Drafts\\\\BaseDraftTestCase\\:\\:getValidTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Drafts/BaseDraftTestCase.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Drafts\\\\BaseDraftTestCase\\:\\:setUpTests\\(\\) has parameter \\$isValid with no type specified\\.$#" + count: 1 + path: tests/Drafts/BaseDraftTestCase.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Drafts\\\\BaseDraftTestCase\\:\\:setUpTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Drafts/BaseDraftTestCase.php + + - + message: "#^Parameter \\#1 \\$json of function json_decode expects string, string\\|false given\\.$#" + count: 1 + path: tests/Drafts/BaseDraftTestCase.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Drafts\\\\Draft3Test\\:\\:getFilePaths\\(\\) should return array\\ but returns array\\\\.$#" + count: 1 + path: tests/Drafts/Draft3Test.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Drafts\\\\Draft3Test\\:\\:getInvalidForAssocTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Drafts/Draft3Test.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Drafts\\\\Draft3Test\\:\\:getValidForAssocTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Drafts/Draft3Test.php + + - + message: "#^Property JsonSchema\\\\Tests\\\\Drafts\\\\Draft3Test\\:\\:\\$schemaSpec has no type specified\\.$#" + count: 1 + path: tests/Drafts/Draft3Test.php + + - + message: "#^Property JsonSchema\\\\Tests\\\\Drafts\\\\Draft3Test\\:\\:\\$validateSchema has no type specified\\.$#" + count: 1 + path: tests/Drafts/Draft3Test.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Drafts\\\\Draft4Test\\:\\:getFilePaths\\(\\) should return array\\ but returns array\\\\.$#" + count: 1 + path: tests/Drafts/Draft4Test.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Drafts\\\\Draft4Test\\:\\:getInvalidForAssocTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Drafts/Draft4Test.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Drafts\\\\Draft4Test\\:\\:getValidForAssocTests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Drafts/Draft4Test.php + + - + message: "#^Property JsonSchema\\\\Tests\\\\Drafts\\\\Draft4Test\\:\\:\\$schemaSpec has no type specified\\.$#" + count: 1 + path: tests/Drafts/Draft4Test.php + + - + message: "#^Property JsonSchema\\\\Tests\\\\Drafts\\\\Draft4Test\\:\\:\\$validateSchema has no type specified\\.$#" + count: 1 + path: tests/Drafts/Draft4Test.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Entity\\\\JsonPointerTest\\:\\:testJsonPointer\\(\\) has parameter \\$expectedPropertyPaths with no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Entity/JsonPointerTest.php + + - + message: "#^Parameter \\#1 \\$value of class JsonSchema\\\\Entity\\\\JsonPointer constructor expects string, null given\\.$#" + count: 1 + path: tests/Entity/JsonPointerTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Exception\\\\JsonDecodingExceptionTest\\:\\:testDefaultMessage\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/Exception/JsonDecodingExceptionTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Exception\\\\JsonDecodingExceptionTest\\:\\:testErrorControlCharacterMessage\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/Exception/JsonDecodingExceptionTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Exception\\\\JsonDecodingExceptionTest\\:\\:testErrorDepthMessage\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/Exception/JsonDecodingExceptionTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Exception\\\\JsonDecodingExceptionTest\\:\\:testErrorInfiniteOrNotANumberMessage\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/Exception/JsonDecodingExceptionTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Exception\\\\JsonDecodingExceptionTest\\:\\:testErrorNoneMessage\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/Exception/JsonDecodingExceptionTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Exception\\\\JsonDecodingExceptionTest\\:\\:testErrorRecursionMessage\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/Exception/JsonDecodingExceptionTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Exception\\\\JsonDecodingExceptionTest\\:\\:testErrorStateMismatchMessage\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/Exception/JsonDecodingExceptionTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Exception\\\\JsonDecodingExceptionTest\\:\\:testErrorSyntaxMessage\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/Exception/JsonDecodingExceptionTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Exception\\\\JsonDecodingExceptionTest\\:\\:testErrorUnsupportedTypeMessage\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/Exception/JsonDecodingExceptionTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Exception\\\\JsonDecodingExceptionTest\\:\\:testErrorUtf8Message\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/Exception/JsonDecodingExceptionTest.php + + - + message: "#^Parameter \\#1 \\$obj of function get_object_vars expects object, mixed given\\.$#" + count: 1 + path: tests/Iterators/ObjectIteratorTest.php + + - + message: "#^Property JsonSchema\\\\Tests\\\\Iterators\\\\ObjectIteratorTest\\:\\:\\$testObject has no type specified\\.$#" + count: 1 + path: tests/Iterators/ObjectIteratorTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\RefTest\\:\\:dataRefIgnoresSiblings\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/RefTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\RefTest\\:\\:testRefIgnoresSiblings\\(\\) has parameter \\$document with no type specified\\.$#" + count: 1 + path: tests/RefTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\RefTest\\:\\:testRefIgnoresSiblings\\(\\) has parameter \\$exception with no type specified\\.$#" + count: 1 + path: tests/RefTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\RefTest\\:\\:testRefIgnoresSiblings\\(\\) has parameter \\$isValid with no type specified\\.$#" + count: 1 + path: tests/RefTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\RefTest\\:\\:testRefIgnoresSiblings\\(\\) has parameter \\$schema with no type specified\\.$#" + count: 1 + path: tests/RefTest.php + + - + message: "#^Call to an undefined method JsonSchema\\\\Uri\\\\UriRetriever\\:\\:reveal\\(\\)\\.$#" + count: 1 + path: tests/SchemaStorageTest.php + + - + message: "#^Call to an undefined method Prophecy\\\\Prophecy\\\\ObjectProphecy\\:\\:retrieve\\(\\)\\.$#" + count: 3 + path: tests/SchemaStorageTest.php + + - + message: "#^Cannot access offset 'test/schema' on mixed\\.$#" + count: 1 + path: tests/SchemaStorageTest.php + + - + message: "#^Cannot access property \\$\\$ref on mixed\\.$#" + count: 1 + path: tests/SchemaStorageTest.php + + - + message: "#^Cannot access property \\$properties on object\\|string\\|false\\|null\\.$#" + count: 3 + path: tests/SchemaStorageTest.php + + - + message: "#^Cannot call method willReturn\\(\\) on object\\|null\\.$#" + count: 3 + path: tests/SchemaStorageTest.php + + - + message: "#^Parameter \\#1 \\$uriRetriever of class JsonSchema\\\\SchemaStorage constructor expects JsonSchema\\\\UriRetrieverInterface\\|null, object given\\.$#" + count: 3 + path: tests/SchemaStorageTest.php + + - + message: "#^Result of method JsonSchema\\\\SchemaStorage\\:\\:addSchema\\(\\) \\(void\\) is used\\.$#" + count: 1 + path: tests/SchemaStorageTest.php + + - + message: "#^Function JsonSchema\\\\Uri\\\\Retrievers\\\\curl_exec\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/Uri/Retrievers/CurlTest.php + + - + message: "#^Function JsonSchema\\\\Uri\\\\Retrievers\\\\curl_exec\\(\\) has parameter \\$curl with no type specified\\.$#" + count: 1 + path: tests/Uri/Retrievers/CurlTest.php + + - + message: "#^Parameter \\#1 \\$expectedFile of static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertStringEqualsFileCanonicalizing\\(\\) expects string, string\\|false given\\.$#" + count: 2 + path: tests/Uri/Retrievers/CurlTest.php + + - + message: "#^Parameter \\#1 \\$filename of function file_get_contents expects string, string\\|false given\\.$#" + count: 1 + path: tests/Uri/Retrievers/CurlTest.php + + - + message: "#^Parameter \\#1 \\$uri of method JsonSchema\\\\Uri\\\\Retrievers\\\\Curl\\:\\:retrieve\\(\\) expects string, string\\|false given\\.$#" + count: 1 + path: tests/Uri/Retrievers/CurlTest.php + + - + message: "#^Property JsonSchema\\\\Tests\\\\Uri\\\\Retrievers\\\\PredefinedArrayTest\\:\\:\\$retriever has no type specified\\.$#" + count: 1 + path: tests/Uri/Retrievers/PredefinedArrayTest.php + + - + message: "#^Cannot access offset 'extends' on mixed\\.$#" + count: 1 + path: tests/Uri/UriRetrieverTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Uri\\\\UriRetrieverTest\\:\\:combinedURITests\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Uri/UriRetrieverTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Uri\\\\UriRetrieverTest\\:\\:getRetrieverMock\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/Uri/UriRetrieverTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Uri\\\\UriRetrieverTest\\:\\:getRetrieverMock\\(\\) has parameter \\$returnSchema with no type specified\\.$#" + count: 1 + path: tests/Uri/UriRetrieverTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Uri\\\\UriRetrieverTest\\:\\:jsonProvider\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: tests/Uri/UriRetrieverTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Uri\\\\UriRetrieverTest\\:\\:mockRetriever\\(\\) has parameter \\$schema with no type specified\\.$#" + count: 1 + path: tests/Uri/UriRetrieverTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Uri\\\\UriRetrieverTest\\:\\:setParentSchemaExtendsValue\\(\\) has parameter \\$parentSchema with no type specified\\.$#" + count: 1 + path: tests/Uri/UriRetrieverTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Uri\\\\UriRetrieverTest\\:\\:setParentSchemaExtendsValue\\(\\) has parameter \\$value with no type specified\\.$#" + count: 1 + path: tests/Uri/UriRetrieverTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Uri\\\\UriRetrieverTest\\:\\:testChildExtendsParentInvalidChildTest\\(\\) has parameter \\$childSchema with no type specified\\.$#" + count: 1 + path: tests/Uri/UriRetrieverTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Uri\\\\UriRetrieverTest\\:\\:testChildExtendsParentInvalidChildTest\\(\\) has parameter \\$parentSchema with no type specified\\.$#" + count: 1 + path: tests/Uri/UriRetrieverTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Uri\\\\UriRetrieverTest\\:\\:testChildExtendsParentInvalidParentTest\\(\\) has parameter \\$childSchema with no type specified\\.$#" + count: 1 + path: tests/Uri/UriRetrieverTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Uri\\\\UriRetrieverTest\\:\\:testChildExtendsParentInvalidParentTest\\(\\) has parameter \\$parentSchema with no type specified\\.$#" + count: 1 + path: tests/Uri/UriRetrieverTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Uri\\\\UriRetrieverTest\\:\\:testChildExtendsParentValidTest\\(\\) has parameter \\$childSchema with no type specified\\.$#" + count: 1 + path: tests/Uri/UriRetrieverTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Uri\\\\UriRetrieverTest\\:\\:testChildExtendsParentValidTest\\(\\) has parameter \\$parentSchema with no type specified\\.$#" + count: 1 + path: tests/Uri/UriRetrieverTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Uri\\\\UriRetrieverTest\\:\\:testResolveCombinedURI\\(\\) has parameter \\$baseURI with no type specified\\.$#" + count: 1 + path: tests/Uri/UriRetrieverTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Uri\\\\UriRetrieverTest\\:\\:testResolveCombinedURI\\(\\) has parameter \\$combinedURI with no type specified\\.$#" + count: 1 + path: tests/Uri/UriRetrieverTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Uri\\\\UriRetrieverTest\\:\\:testResolveCombinedURI\\(\\) has parameter \\$uri with no type specified\\.$#" + count: 1 + path: tests/Uri/UriRetrieverTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Uri\\\\UriRetrieverTest\\:\\:testResolveRelativeUri\\(\\) has parameter \\$childSchema with no type specified\\.$#" + count: 1 + path: tests/Uri/UriRetrieverTest.php + + - + message: "#^Method JsonSchema\\\\Tests\\\\Uri\\\\UriRetrieverTest\\:\\:testResolveRelativeUri\\(\\) has parameter \\$parentSchema with no type specified\\.$#" + count: 1 + path: tests/Uri/UriRetrieverTest.php + + - + message: "#^Parameter \\#1 \\$objectOrValue of method ReflectionProperty\\:\\:setValue\\(\\) expects object\\|null, mixed given\\.$#" + count: 1 + path: tests/Uri/UriRetrieverTest.php + + - + message: "#^Parameter \\#1 \\$str of function md5 expects string, string\\|false given\\.$#" + count: 1 + path: tests/Uri/UriRetrieverTest.php + + - + message: "#^Parameter \\#2 \\$uri of method JsonSchema\\\\Uri\\\\UriRetriever\\:\\:confirmMediaType\\(\\) expects string, null given\\.$#" + count: 3 + path: tests/Uri/UriRetrieverTest.php + + - + message: "#^Property JsonSchema\\\\Tests\\\\Uri\\\\UriRetrieverTest\\:\\:\\$validator has no type specified\\.$#" + count: 1 + path: tests/Uri/UriRetrieverTest.php + diff --git a/phpstan.neon b/phpstan.neon index 92d8664f..29dc60a1 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -2,6 +2,7 @@ parameters: level: max paths: - ./src/ + - ./tests/ phpVersion: 70200 includes: diff --git a/src/JsonSchema/Constraints/UndefinedConstraint.php b/src/JsonSchema/Constraints/UndefinedConstraint.php index 519ad826..dcff2e7d 100644 --- a/src/JsonSchema/Constraints/UndefinedConstraint.php +++ b/src/JsonSchema/Constraints/UndefinedConstraint.php @@ -60,7 +60,6 @@ public function check(&$value, $schema = null, ?JsonPointer $path = null, $i = n * * @param mixed $value * @param mixed $schema - * @param JsonPointer $path * @param string $i */ public function validateTypes(&$value, $schema, JsonPointer $path, $i = null): void @@ -111,7 +110,6 @@ public function validateTypes(&$value, $schema, JsonPointer $path, $i = null): v * * @param mixed $value * @param mixed $schema - * @param JsonPointer $path * @param string $i */ protected function validateCommonProperties(&$value, $schema, JsonPointer $path, $i = ''): void @@ -305,7 +303,6 @@ protected function applyDefaultValues(&$value, $schema, $path): void * * @param mixed $value * @param mixed $schema - * @param JsonPointer $path * @param string $i */ protected function validateOfProperties(&$value, $schema, JsonPointer $path, $i = ''): void @@ -379,7 +376,6 @@ protected function validateOfProperties(&$value, $schema, JsonPointer $path, $i * * @param mixed $value * @param mixed $dependencies - * @param JsonPointer $path * @param string $i */ protected function validateDependencies($value, $dependencies, JsonPointer $path, $i = ''): void diff --git a/src/JsonSchema/Uri/Retrievers/PredefinedArray.php b/src/JsonSchema/Uri/Retrievers/PredefinedArray.php index db279b7a..5fe00b2f 100644 --- a/src/JsonSchema/Uri/Retrievers/PredefinedArray.php +++ b/src/JsonSchema/Uri/Retrievers/PredefinedArray.php @@ -28,9 +28,6 @@ class PredefinedArray extends AbstractRetriever private $schemas; /** - * Constructor - * - * @param array $schemas * @param string $contentType */ public function __construct(array $schemas, $contentType = Validator::SCHEMA_MEDIA_TYPE) diff --git a/src/JsonSchema/Uri/UriResolver.php b/src/JsonSchema/Uri/UriResolver.php index 88fab217..931dbc74 100644 --- a/src/JsonSchema/Uri/UriResolver.php +++ b/src/JsonSchema/Uri/UriResolver.php @@ -50,8 +50,6 @@ public function parse($uri): array /** * Builds a URI based on n array with the main components - * - * @param array $components */ public function generate(array $components): string { From 6d41cc39485889df351c942f1aac683e2aa1be87 Mon Sep 17 00:00:00 2001 From: Jack Worman Date: Fri, 21 Feb 2025 08:29:07 -0500 Subject: [PATCH 5/7] Add-return-types --- src/JsonSchema/Constraints/UndefinedConstraint.php | 6 +++--- src/JsonSchema/SchemaStorageInterface.php | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/JsonSchema/Constraints/UndefinedConstraint.php b/src/JsonSchema/Constraints/UndefinedConstraint.php index dcff2e7d..2cecf683 100644 --- a/src/JsonSchema/Constraints/UndefinedConstraint.php +++ b/src/JsonSchema/Constraints/UndefinedConstraint.php @@ -374,9 +374,9 @@ protected function validateOfProperties(&$value, $schema, JsonPointer $path, $i /** * Validate dependencies * - * @param mixed $value - * @param mixed $dependencies - * @param string $i + * @param mixed $value + * @param mixed $dependencies + * @param string $i */ protected function validateDependencies($value, $dependencies, JsonPointer $path, $i = ''): void { diff --git a/src/JsonSchema/SchemaStorageInterface.php b/src/JsonSchema/SchemaStorageInterface.php index 7a765944..9d99eaa6 100644 --- a/src/JsonSchema/SchemaStorageInterface.php +++ b/src/JsonSchema/SchemaStorageInterface.php @@ -18,6 +18,7 @@ public function addSchema($id, $schema = null): void; * Returns schema for given identifier, or null if it does not exist * * @param string $id + * * @return object|string|false|null */ public function getSchema($id); @@ -26,6 +27,7 @@ public function getSchema($id); * Returns schema for given reference with all sub-references resolved * * @param string $ref + * * @return object|false */ public function resolveRef($ref); @@ -34,6 +36,7 @@ public function resolveRef($ref); * Returns schema referenced by '$ref' property * * @param mixed $refSchema + * * @return object|string|null */ public function resolveRefSchema($refSchema); From d9195eda14020fa07493e2db5f874552ac6b2e1d Mon Sep 17 00:00:00 2001 From: Jack Worman Date: Fri, 21 Feb 2025 08:31:19 -0500 Subject: [PATCH 6/7] Add-return-types --- src/JsonSchema/Constraints/UndefinedConstraint.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/JsonSchema/Constraints/UndefinedConstraint.php b/src/JsonSchema/Constraints/UndefinedConstraint.php index 2cecf683..44f34b13 100644 --- a/src/JsonSchema/Constraints/UndefinedConstraint.php +++ b/src/JsonSchema/Constraints/UndefinedConstraint.php @@ -301,9 +301,9 @@ protected function applyDefaultValues(&$value, $schema, $path): void /** * Validate allOf, anyOf, and oneOf properties * - * @param mixed $value - * @param mixed $schema - * @param string $i + * @param mixed $value + * @param mixed $schema + * @param string $i */ protected function validateOfProperties(&$value, $schema, JsonPointer $path, $i = ''): void { From 8e1609d5473e16a0cf7b689a82da6b46daeb5b7c Mon Sep 17 00:00:00 2001 From: Jack Worman Date: Fri, 21 Feb 2025 08:38:41 -0500 Subject: [PATCH 7/7] Add-return-types --- src/JsonSchema/Constraints/UndefinedConstraint.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/JsonSchema/Constraints/UndefinedConstraint.php b/src/JsonSchema/Constraints/UndefinedConstraint.php index 44f34b13..5793ac53 100644 --- a/src/JsonSchema/Constraints/UndefinedConstraint.php +++ b/src/JsonSchema/Constraints/UndefinedConstraint.php @@ -108,9 +108,9 @@ public function validateTypes(&$value, $schema, JsonPointer $path, $i = null): v /** * Validates common properties * - * @param mixed $value - * @param mixed $schema - * @param string $i + * @param mixed $value + * @param mixed $schema + * @param string $i */ protected function validateCommonProperties(&$value, $schema, JsonPointer $path, $i = ''): void {