From b5c8c9ee12c8b47346a847c7277f355c1f3ff33a Mon Sep 17 00:00:00 2001 From: Danny van der Sluijs Date: Thu, 21 Nov 2024 22:10:43 +0100 Subject: [PATCH] refactor: add declare strict_types to all classes in ./src (#758) * refactor: add declare strict_types to all classes in ./src * fix: correct regression from adding declare strict_types * refactor: enforce string at datetime casting * docs: add changelog entry --- CHANGELOG.md | 1 + src/JsonSchema/ConstraintError.php | 2 ++ src/JsonSchema/Constraints/BaseConstraint.php | 2 ++ src/JsonSchema/Constraints/CollectionConstraint.php | 2 ++ src/JsonSchema/Constraints/ConstConstraint.php | 2 ++ src/JsonSchema/Constraints/Constraint.php | 2 ++ src/JsonSchema/Constraints/ConstraintInterface.php | 2 ++ src/JsonSchema/Constraints/EnumConstraint.php | 2 ++ src/JsonSchema/Constraints/Factory.php | 2 ++ src/JsonSchema/Constraints/FormatConstraint.php | 4 +++- src/JsonSchema/Constraints/NumberConstraint.php | 2 ++ src/JsonSchema/Constraints/ObjectConstraint.php | 2 ++ src/JsonSchema/Constraints/SchemaConstraint.php | 2 ++ src/JsonSchema/Constraints/StringConstraint.php | 2 ++ src/JsonSchema/Constraints/TypeCheck/LooseTypeCheck.php | 2 ++ src/JsonSchema/Constraints/TypeCheck/StrictTypeCheck.php | 2 ++ src/JsonSchema/Constraints/TypeCheck/TypeCheckInterface.php | 2 ++ src/JsonSchema/Constraints/TypeConstraint.php | 2 ++ src/JsonSchema/Constraints/UndefinedConstraint.php | 2 ++ src/JsonSchema/Entity/JsonPointer.php | 4 +++- src/JsonSchema/Enum.php | 2 ++ src/JsonSchema/Exception/ExceptionInterface.php | 2 ++ src/JsonSchema/Exception/InvalidArgumentException.php | 2 ++ src/JsonSchema/Exception/InvalidConfigException.php | 2 ++ src/JsonSchema/Exception/InvalidSchemaException.php | 2 ++ src/JsonSchema/Exception/InvalidSchemaMediaTypeException.php | 2 ++ src/JsonSchema/Exception/InvalidSourceUriException.php | 2 ++ src/JsonSchema/Exception/JsonDecodingException.php | 2 ++ src/JsonSchema/Exception/ResourceNotFoundException.php | 2 ++ src/JsonSchema/Exception/RuntimeException.php | 2 ++ src/JsonSchema/Exception/UnresolvableJsonPointerException.php | 2 ++ src/JsonSchema/Exception/UriResolverException.php | 2 ++ src/JsonSchema/Exception/ValidationException.php | 2 ++ src/JsonSchema/Iterator/ObjectIterator.php | 2 ++ src/JsonSchema/Rfc3339.php | 2 ++ src/JsonSchema/SchemaStorage.php | 2 ++ src/JsonSchema/SchemaStorageInterface.php | 2 ++ src/JsonSchema/Uri/Retrievers/AbstractRetriever.php | 3 +++ src/JsonSchema/Uri/Retrievers/Curl.php | 2 ++ src/JsonSchema/Uri/Retrievers/FileGetContents.php | 2 ++ src/JsonSchema/Uri/Retrievers/PredefinedArray.php | 2 ++ src/JsonSchema/Uri/Retrievers/UriRetrieverInterface.php | 2 ++ src/JsonSchema/Uri/UriResolver.php | 2 ++ src/JsonSchema/Uri/UriRetriever.php | 2 ++ src/JsonSchema/UriResolverInterface.php | 2 ++ src/JsonSchema/UriRetrieverInterface.php | 2 ++ src/JsonSchema/Validator.php | 2 ++ 47 files changed, 96 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 99726be8..7f7db619 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add ext-json to composer.json to ensure JSON extension available ([#759](https://github.com/jsonrainbow/json-schema/pull/759)) - Add visibility modifiers to class constants ([#757](https://github.com/jsonrainbow/json-schema/pull/757)) - Include PHP 8.4 in workflow ([#765](https://github.com/jsonrainbow/json-schema/pull/765)) +- Add `strict_types=1` to all classes in ./src ([#758](https://github.com/jsonrainbow/json-schema/pull/758)) ## [6.0.0] - 2024-07-30 ### Added diff --git a/src/JsonSchema/ConstraintError.php b/src/JsonSchema/ConstraintError.php index ac7358a1..8b1c1450 100644 --- a/src/JsonSchema/ConstraintError.php +++ b/src/JsonSchema/ConstraintError.php @@ -1,5 +1,7 @@ propertyPaths = $propertyPaths; + $new->propertyPaths = array_map(function ($p): string { return (string) $p; }, $propertyPaths); return $new; } diff --git a/src/JsonSchema/Enum.php b/src/JsonSchema/Enum.php index c52f8daa..ef8cb285 100644 --- a/src/JsonSchema/Enum.php +++ b/src/JsonSchema/Enum.php @@ -1,5 +1,7 @@