From 9420ae55f4685e03347cd15c47cb5ce5f803ae50 Mon Sep 17 00:00:00 2001 From: Julien RAVIA Date: Wed, 29 Oct 2025 12:11:00 +0100 Subject: [PATCH] Remove deprecations in exceptions --- src/Exception/DuplicateSchemaException.php | 5 +++-- src/Exception/FilterNotFoundException.php | 2 +- src/Exception/InvalidJsonPointerException.php | 2 +- src/Exception/InvalidSchemaDraftException.php | 5 +++-- src/Exception/InvalidSchemaException.php | 2 +- src/Exception/InvalidSchemaIdException.php | 2 +- src/Exception/SchemaDraftNotSupportedException.php | 5 +++-- src/Exception/SchemaKeywordException.php | 5 +++-- src/Exception/SchemaNotFoundException.php | 2 +- src/Exception/UnknownMediaTypeException.php | 5 +++-- 10 files changed, 20 insertions(+), 15 deletions(-) diff --git a/src/Exception/DuplicateSchemaException.php b/src/Exception/DuplicateSchemaException.php index c016242..67cc0f0 100644 --- a/src/Exception/DuplicateSchemaException.php +++ b/src/Exception/DuplicateSchemaException.php @@ -17,7 +17,8 @@ namespace Opis\JsonSchema\Exception; -use stdClass, Throwable; +use stdClass; +use Throwable; class DuplicateSchemaException extends AbstractSchemaException { @@ -38,7 +39,7 @@ class DuplicateSchemaException extends AbstractSchemaException * @param array $container * @param Throwable|null $previous */ - public function __construct(string $id, stdClass $schema, array $container = [], Throwable $previous = null) + public function __construct(string $id, stdClass $schema, array $container = [], ?Throwable $previous = null) { $this->id = $id; $this->schema = $schema; diff --git a/src/Exception/FilterNotFoundException.php b/src/Exception/FilterNotFoundException.php index 7cae0e2..01db251 100644 --- a/src/Exception/FilterNotFoundException.php +++ b/src/Exception/FilterNotFoundException.php @@ -34,7 +34,7 @@ class FilterNotFoundException extends AbstractSchemaException * @param string $filter * @param Throwable|null $previous */ - public function __construct(string $type, string $filter, Throwable $previous = null) + public function __construct(string $type, string $filter, ?Throwable $previous = null) { $this->type = $type; $this->filter = $filter; diff --git a/src/Exception/InvalidJsonPointerException.php b/src/Exception/InvalidJsonPointerException.php index 5d7557f..7bef08a 100644 --- a/src/Exception/InvalidJsonPointerException.php +++ b/src/Exception/InvalidJsonPointerException.php @@ -30,7 +30,7 @@ class InvalidJsonPointerException extends AbstractSchemaException * @param string $pointer * @param Throwable|null $previous */ - public function __construct(string $pointer, Throwable $previous = null) + public function __construct(string $pointer, ?Throwable $previous = null) { $this->pointer = $pointer; parent::__construct("Invalid JSON pointer: $pointer", 0, $previous); diff --git a/src/Exception/InvalidSchemaDraftException.php b/src/Exception/InvalidSchemaDraftException.php index 452d6e7..82b94ef 100644 --- a/src/Exception/InvalidSchemaDraftException.php +++ b/src/Exception/InvalidSchemaDraftException.php @@ -17,7 +17,8 @@ namespace Opis\JsonSchema\Exception; -use stdClass, Throwable; +use stdClass; +use Throwable; class InvalidSchemaDraftException extends AbstractSchemaException { @@ -30,7 +31,7 @@ class InvalidSchemaDraftException extends AbstractSchemaException * @param stdClass $schema * @param Throwable|null $previous */ - public function __construct(stdClass $schema, Throwable $previous = null) + public function __construct(stdClass $schema, ?Throwable $previous = null) { $this->schema = $schema; parent::__construct("Invalid '\$schema' property", 0, $previous); diff --git a/src/Exception/InvalidSchemaException.php b/src/Exception/InvalidSchemaException.php index 8311edd..ab3b12d 100644 --- a/src/Exception/InvalidSchemaException.php +++ b/src/Exception/InvalidSchemaException.php @@ -30,7 +30,7 @@ class InvalidSchemaException extends AbstractSchemaException * @param $schema * @param Throwable|null $previous */ - public function __construct($schema, Throwable $previous = null) + public function __construct($schema, ?Throwable $previous = null) { $this->schema = $schema; $type = is_object($schema) ? get_class($schema) : gettype($schema); diff --git a/src/Exception/InvalidSchemaIdException.php b/src/Exception/InvalidSchemaIdException.php index 50dc40c..4a76bca 100644 --- a/src/Exception/InvalidSchemaIdException.php +++ b/src/Exception/InvalidSchemaIdException.php @@ -30,7 +30,7 @@ class InvalidSchemaIdException extends AbstractSchemaException * @param string $id * @param Throwable|null $previous */ - public function __construct(string $id, Throwable $previous = null) + public function __construct(string $id, ?Throwable $previous = null) { $this->id = $id; parent::__construct("Invalid id '{$id}'", 0, $previous); diff --git a/src/Exception/SchemaDraftNotSupportedException.php b/src/Exception/SchemaDraftNotSupportedException.php index 5b97ce5..2ed780c 100644 --- a/src/Exception/SchemaDraftNotSupportedException.php +++ b/src/Exception/SchemaDraftNotSupportedException.php @@ -17,7 +17,8 @@ namespace Opis\JsonSchema\Exception; -use stdClass, Throwable; +use stdClass; +use Throwable; class SchemaDraftNotSupportedException extends AbstractSchemaException { @@ -34,7 +35,7 @@ class SchemaDraftNotSupportedException extends AbstractSchemaException * @param string $draft * @param Throwable|null $previous */ - public function __construct(stdClass $schema, string $draft, Throwable $previous = null) + public function __construct(stdClass $schema, string $draft, ?Throwable $previous = null) { $this->schema = $schema; $this->draft = $draft; diff --git a/src/Exception/SchemaKeywordException.php b/src/Exception/SchemaKeywordException.php index dbef692..a8ddf47 100644 --- a/src/Exception/SchemaKeywordException.php +++ b/src/Exception/SchemaKeywordException.php @@ -17,7 +17,8 @@ namespace Opis\JsonSchema\Exception; -use stdClass, Throwable; +use stdClass; +use Throwable; class SchemaKeywordException extends AbstractSchemaException { @@ -39,7 +40,7 @@ class SchemaKeywordException extends AbstractSchemaException * @param string $message * @param Throwable|null $previous */ - public function __construct(stdClass $schema, string $keyword, $value, string $message, Throwable $previous = null) + public function __construct(stdClass $schema, string $keyword, $value, string $message, ?Throwable $previous = null) { $this->schema = $schema; $this->keyword = $keyword; diff --git a/src/Exception/SchemaNotFoundException.php b/src/Exception/SchemaNotFoundException.php index 9a169e6..46ee2a8 100644 --- a/src/Exception/SchemaNotFoundException.php +++ b/src/Exception/SchemaNotFoundException.php @@ -30,7 +30,7 @@ class SchemaNotFoundException extends AbstractSchemaException * @param string $id * @param Throwable|null $previous */ - public function __construct(string $id, Throwable $previous = null) + public function __construct(string $id, ?Throwable $previous = null) { $this->id = $id; parent::__construct("Schema '{$id}' was not found or could not be loaded", 0, $previous); diff --git a/src/Exception/UnknownMediaTypeException.php b/src/Exception/UnknownMediaTypeException.php index 1f12ab7..df1c5d9 100644 --- a/src/Exception/UnknownMediaTypeException.php +++ b/src/Exception/UnknownMediaTypeException.php @@ -17,7 +17,8 @@ namespace Opis\JsonSchema\Exception; -use stdClass, Throwable; +use stdClass; +use Throwable; class UnknownMediaTypeException extends AbstractSchemaException { @@ -31,7 +32,7 @@ class UnknownMediaTypeException extends AbstractSchemaException /** * @inheritDoc */ - public function __construct(stdClass $schema, string $media, Throwable $previous = null) + public function __construct(stdClass $schema, string $media, ?Throwable $previous = null) { $this->schema = $schema; $this->media = $media;