From 8f951fd7e62af4eb376f0d2773e4f600ecf6105a Mon Sep 17 00:00:00 2001 From: Sean Molenaar Date: Tue, 31 Dec 2024 11:45:17 +0100 Subject: [PATCH] General: Fix deprecations in PHP 8.4 --- src/Lunr/Corona/Exceptions/BadGatewayException.php | 2 +- src/Lunr/Corona/Exceptions/BadRequestException.php | 2 +- src/Lunr/Corona/Exceptions/ClientDataHttpException.php | 2 +- src/Lunr/Corona/Exceptions/ConflictException.php | 2 +- src/Lunr/Corona/Exceptions/ExpectationFailedException.php | 2 +- src/Lunr/Corona/Exceptions/FailedDependencyException.php | 2 +- src/Lunr/Corona/Exceptions/ForbiddenException.php | 2 +- src/Lunr/Corona/Exceptions/HttpException.php | 2 +- src/Lunr/Corona/Exceptions/InternalServerErrorException.php | 2 +- src/Lunr/Corona/Exceptions/MethodNotAllowedException.php | 2 +- src/Lunr/Corona/Exceptions/NotFoundException.php | 2 +- src/Lunr/Corona/Exceptions/NotImplementedException.php | 2 +- src/Lunr/Corona/Exceptions/PreconditionFailedException.php | 2 +- .../Corona/Exceptions/RequestedRangeNotSatisfiableException.php | 2 +- src/Lunr/Corona/Exceptions/TemporarilyDisabledException.php | 2 +- src/Lunr/Corona/Exceptions/UnauthorizedException.php | 2 +- src/Lunr/Corona/Exceptions/UnprocessableEntityException.php | 2 +- src/Lunr/Corona/Tests/Helpers/MockUncaughtException.php | 2 +- 18 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/Lunr/Corona/Exceptions/BadGatewayException.php b/src/Lunr/Corona/Exceptions/BadGatewayException.php index 0ba2c690..b9a1908c 100644 --- a/src/Lunr/Corona/Exceptions/BadGatewayException.php +++ b/src/Lunr/Corona/Exceptions/BadGatewayException.php @@ -26,7 +26,7 @@ class BadGatewayException extends HttpException * @param int $app_code Application error code * @param Exception|null $previous The previously thrown exception */ - public function __construct(?string $message = NULL, int $app_code = 0, Exception $previous = NULL) + public function __construct(?string $message = NULL, int $app_code = 0, ?Exception $previous = NULL) { parent::__construct($message, HttpCode::BAD_GATEWAY, $app_code, $previous); } diff --git a/src/Lunr/Corona/Exceptions/BadRequestException.php b/src/Lunr/Corona/Exceptions/BadRequestException.php index a955a4e3..43e87f4b 100644 --- a/src/Lunr/Corona/Exceptions/BadRequestException.php +++ b/src/Lunr/Corona/Exceptions/BadRequestException.php @@ -26,7 +26,7 @@ class BadRequestException extends ClientDataHttpException * @param int $app_code Application error code * @param Exception|null $previous The previously thrown exception */ - public function __construct(?string $message = NULL, int $app_code = 0, Exception $previous = NULL) + public function __construct(?string $message = NULL, int $app_code = 0, ?Exception $previous = NULL) { parent::__construct($message, HttpCode::BAD_REQUEST, $app_code, $previous); } diff --git a/src/Lunr/Corona/Exceptions/ClientDataHttpException.php b/src/Lunr/Corona/Exceptions/ClientDataHttpException.php index 5d6515b0..f3dc202d 100644 --- a/src/Lunr/Corona/Exceptions/ClientDataHttpException.php +++ b/src/Lunr/Corona/Exceptions/ClientDataHttpException.php @@ -43,7 +43,7 @@ abstract class ClientDataHttpException extends HttpException * @param int $app_code Application error code * @param Exception|null $previous The previously thrown exception */ - public function __construct(?string $message = NULL, int $code = 0, int $app_code = 0, Exception $previous = NULL) + public function __construct(?string $message = NULL, int $code = 0, int $app_code = 0, ?Exception $previous = NULL) { parent::__construct($message, $code, $app_code, $previous); } diff --git a/src/Lunr/Corona/Exceptions/ConflictException.php b/src/Lunr/Corona/Exceptions/ConflictException.php index d647e47c..ddd005a3 100644 --- a/src/Lunr/Corona/Exceptions/ConflictException.php +++ b/src/Lunr/Corona/Exceptions/ConflictException.php @@ -26,7 +26,7 @@ class ConflictException extends HttpException * @param int $app_code Application error code * @param Exception|null $previous The previously thrown exception */ - public function __construct(?string $message = NULL, int $app_code = 0, Exception $previous = NULL) + public function __construct(?string $message = NULL, int $app_code = 0, ?Exception $previous = NULL) { parent::__construct($message, HttpCode::CONFLICT, $app_code, $previous); } diff --git a/src/Lunr/Corona/Exceptions/ExpectationFailedException.php b/src/Lunr/Corona/Exceptions/ExpectationFailedException.php index b88a2807..871b3469 100644 --- a/src/Lunr/Corona/Exceptions/ExpectationFailedException.php +++ b/src/Lunr/Corona/Exceptions/ExpectationFailedException.php @@ -26,7 +26,7 @@ class ExpectationFailedException extends HttpException * @param int $app_code Application error code * @param Exception|null $previous The previously thrown exception */ - public function __construct(?string $message = NULL, int $app_code = 0, Exception $previous = NULL) + public function __construct(?string $message = NULL, int $app_code = 0, ?Exception $previous = NULL) { parent::__construct($message, HttpCode::EXPECTATION_FAILED, $app_code, $previous); } diff --git a/src/Lunr/Corona/Exceptions/FailedDependencyException.php b/src/Lunr/Corona/Exceptions/FailedDependencyException.php index 63c039c2..c4914c7d 100644 --- a/src/Lunr/Corona/Exceptions/FailedDependencyException.php +++ b/src/Lunr/Corona/Exceptions/FailedDependencyException.php @@ -26,7 +26,7 @@ class FailedDependencyException extends HttpException * @param int $app_code Application error code * @param Exception|null $previous The previously thrown exception */ - public function __construct(?string $message = NULL, int $app_code = 0, Exception $previous = NULL) + public function __construct(?string $message = NULL, int $app_code = 0, ?Exception $previous = NULL) { parent::__construct($message, HttpCode::FAILED_DEPENDENCY, $app_code, $previous); } diff --git a/src/Lunr/Corona/Exceptions/ForbiddenException.php b/src/Lunr/Corona/Exceptions/ForbiddenException.php index 6fc4a270..417e7ff4 100644 --- a/src/Lunr/Corona/Exceptions/ForbiddenException.php +++ b/src/Lunr/Corona/Exceptions/ForbiddenException.php @@ -26,7 +26,7 @@ class ForbiddenException extends ClientDataHttpException * @param int $app_code Application error code * @param Exception|null $previous The previously thrown exception */ - public function __construct(?string $message = NULL, int $app_code = 0, Exception $previous = NULL) + public function __construct(?string $message = NULL, int $app_code = 0, ?Exception $previous = NULL) { parent::__construct($message, HttpCode::FORBIDDEN, $app_code, $previous); } diff --git a/src/Lunr/Corona/Exceptions/HttpException.php b/src/Lunr/Corona/Exceptions/HttpException.php index afaa2cdd..af6c2537 100644 --- a/src/Lunr/Corona/Exceptions/HttpException.php +++ b/src/Lunr/Corona/Exceptions/HttpException.php @@ -32,7 +32,7 @@ class HttpException extends Exception * @param int $app_code Application error code * @param Exception|null $previous The previously thrown exception */ - public function __construct(?string $message = NULL, int $code = 0, int $app_code = 0, Exception $previous = NULL) + public function __construct(?string $message = NULL, int $code = 0, int $app_code = 0, ?Exception $previous = NULL) { parent::__construct($message ?? '', $code, $previous); diff --git a/src/Lunr/Corona/Exceptions/InternalServerErrorException.php b/src/Lunr/Corona/Exceptions/InternalServerErrorException.php index 81ab6271..63e0a710 100644 --- a/src/Lunr/Corona/Exceptions/InternalServerErrorException.php +++ b/src/Lunr/Corona/Exceptions/InternalServerErrorException.php @@ -26,7 +26,7 @@ class InternalServerErrorException extends HttpException * @param int $app_code Application error code * @param Exception|null $previous The previously thrown exception */ - public function __construct(?string $message = NULL, int $app_code = 0, Exception $previous = NULL) + public function __construct(?string $message = NULL, int $app_code = 0, ?Exception $previous = NULL) { parent::__construct($message, HttpCode::INTERNAL_SERVER_ERROR, $app_code, $previous); } diff --git a/src/Lunr/Corona/Exceptions/MethodNotAllowedException.php b/src/Lunr/Corona/Exceptions/MethodNotAllowedException.php index f3925229..71eddaf0 100644 --- a/src/Lunr/Corona/Exceptions/MethodNotAllowedException.php +++ b/src/Lunr/Corona/Exceptions/MethodNotAllowedException.php @@ -29,7 +29,7 @@ class MethodNotAllowedException extends HttpException public function __construct( string $message = 'The used HTTP method is not supported for this resource!', int $app_code = 0, - Exception $previous = NULL + ?Exception $previous = NULL ) { parent::__construct($message, HttpCode::METHOD_NOT_ALLOWED, $app_code, $previous); diff --git a/src/Lunr/Corona/Exceptions/NotFoundException.php b/src/Lunr/Corona/Exceptions/NotFoundException.php index 888ac400..786e5f00 100644 --- a/src/Lunr/Corona/Exceptions/NotFoundException.php +++ b/src/Lunr/Corona/Exceptions/NotFoundException.php @@ -26,7 +26,7 @@ class NotFoundException extends HttpException * @param int $app_code Application error code * @param Exception|null $previous The previously thrown exception */ - public function __construct(?string $message = NULL, int $app_code = 0, Exception $previous = NULL) + public function __construct(?string $message = NULL, int $app_code = 0, ?Exception $previous = NULL) { parent::__construct($message, HttpCode::NOT_FOUND, $app_code, $previous); } diff --git a/src/Lunr/Corona/Exceptions/NotImplementedException.php b/src/Lunr/Corona/Exceptions/NotImplementedException.php index 8a8bc5fc..f6169d6e 100644 --- a/src/Lunr/Corona/Exceptions/NotImplementedException.php +++ b/src/Lunr/Corona/Exceptions/NotImplementedException.php @@ -26,7 +26,7 @@ class NotImplementedException extends HttpException * @param int $app_code Application error code * @param Exception|null $previous The previously thrown exception */ - public function __construct(string $message = 'Not implemented!', int $app_code = 0, Exception $previous = NULL) + public function __construct(string $message = 'Not implemented!', int $app_code = 0, ?Exception $previous = NULL) { parent::__construct($message, HttpCode::NOT_IMPLEMENTED, $app_code, $previous); } diff --git a/src/Lunr/Corona/Exceptions/PreconditionFailedException.php b/src/Lunr/Corona/Exceptions/PreconditionFailedException.php index 60b55694..6784a347 100644 --- a/src/Lunr/Corona/Exceptions/PreconditionFailedException.php +++ b/src/Lunr/Corona/Exceptions/PreconditionFailedException.php @@ -26,7 +26,7 @@ class PreconditionFailedException extends HttpException * @param int $app_code Application error code * @param Exception|null $previous The previously thrown exception */ - public function __construct(?string $message = NULL, int $app_code = 0, Exception $previous = NULL) + public function __construct(?string $message = NULL, int $app_code = 0, ?Exception $previous = NULL) { parent::__construct($message, HttpCode::PRECONDITION_FAILED, $app_code, $previous); } diff --git a/src/Lunr/Corona/Exceptions/RequestedRangeNotSatisfiableException.php b/src/Lunr/Corona/Exceptions/RequestedRangeNotSatisfiableException.php index 9e04ae4e..a924d220 100644 --- a/src/Lunr/Corona/Exceptions/RequestedRangeNotSatisfiableException.php +++ b/src/Lunr/Corona/Exceptions/RequestedRangeNotSatisfiableException.php @@ -26,7 +26,7 @@ class RequestedRangeNotSatisfiableException extends HttpException * @param int $app_code Application error code * @param Exception|null $previous The previously thrown exception */ - public function __construct(?string $message = NULL, int $app_code = 0, Exception $previous = NULL) + public function __construct(?string $message = NULL, int $app_code = 0, ?Exception $previous = NULL) { parent::__construct($message, HttpCode::REQUESTED_RANGE_NOT_SATISFIABLE, $app_code, $previous); } diff --git a/src/Lunr/Corona/Exceptions/TemporarilyDisabledException.php b/src/Lunr/Corona/Exceptions/TemporarilyDisabledException.php index 46c8443c..3d908a09 100644 --- a/src/Lunr/Corona/Exceptions/TemporarilyDisabledException.php +++ b/src/Lunr/Corona/Exceptions/TemporarilyDisabledException.php @@ -24,7 +24,7 @@ class TemporarilyDisabledException extends HttpException * @param int $app_code Application error code * @param Exception|null $previous The previously thrown exception */ - public function __construct(string $message = 'The requested API is temporarily disabled', int $app_code = 0, Exception $previous = NULL) + public function __construct(string $message = 'The requested API is temporarily disabled', int $app_code = 0, ?Exception $previous = NULL) { parent::__construct($message, 540, $app_code, $previous); } diff --git a/src/Lunr/Corona/Exceptions/UnauthorizedException.php b/src/Lunr/Corona/Exceptions/UnauthorizedException.php index 0dfa625d..78388ca8 100644 --- a/src/Lunr/Corona/Exceptions/UnauthorizedException.php +++ b/src/Lunr/Corona/Exceptions/UnauthorizedException.php @@ -26,7 +26,7 @@ class UnauthorizedException extends HttpException * @param int $app_code Application error code * @param Exception|null $previous The previously thrown exception */ - public function __construct(?string $message = NULL, int $app_code = 0, Exception $previous = NULL) + public function __construct(?string $message = NULL, int $app_code = 0, ?Exception $previous = NULL) { parent::__construct($message, HttpCode::UNAUTHORIZED, $app_code, $previous); } diff --git a/src/Lunr/Corona/Exceptions/UnprocessableEntityException.php b/src/Lunr/Corona/Exceptions/UnprocessableEntityException.php index 2406bd61..281b1eeb 100644 --- a/src/Lunr/Corona/Exceptions/UnprocessableEntityException.php +++ b/src/Lunr/Corona/Exceptions/UnprocessableEntityException.php @@ -26,7 +26,7 @@ class UnprocessableEntityException extends HttpException * @param int $app_code The Exception code. * @param Exception|null $previous The previous exception used for the exception chaining. */ - public function __construct(?string $message = NULL, int $app_code = 0, Exception $previous = NULL) + public function __construct(?string $message = NULL, int $app_code = 0, ?Exception $previous = NULL) { parent::__construct($message, HttpCode::UNPROCESSABLE_ENTITY, $app_code, $previous); } diff --git a/src/Lunr/Corona/Tests/Helpers/MockUncaughtException.php b/src/Lunr/Corona/Tests/Helpers/MockUncaughtException.php index e9a52bae..d3356628 100644 --- a/src/Lunr/Corona/Tests/Helpers/MockUncaughtException.php +++ b/src/Lunr/Corona/Tests/Helpers/MockUncaughtException.php @@ -24,7 +24,7 @@ class MockUncaughtException extends Exception * @param int $code The exception code * @param Exception|null $previous The previously thrown exception */ - public function __construct(?string $message = NULL, int $code = 0, Exception $previous = NULL) + public function __construct(?string $message = NULL, int $code = 0, ?Exception $previous = NULL) { parent::__construct($message ?? '', $code, $previous); }