From 869a772b05ac484610be9ce8f3e6331100b5c086 Mon Sep 17 00:00:00 2001 From: yoeriwalstra Date: Fri, 22 May 2026 13:03:03 +0200 Subject: [PATCH] make nullable parameter type explicit using ? operator --- src/Errors/GenericCarrierError.php | 2 +- src/Errors/InvalidInputContextError.php | 2 +- src/Errors/InvalidInputError.php | 2 +- src/Errors/MissingInputError.php | 2 +- src/Exceptions/AuthException.php | 2 +- src/Exceptions/CarrierApiException.php | 2 +- src/Exceptions/ExternalRequestException.php | 2 +- src/Exceptions/ForbiddenException.php | 2 +- src/Exceptions/InvalidAccessTokenException.php | 2 +- src/Exceptions/InvalidExternalErrorException.php | 2 +- src/Exceptions/InvalidJsonSchemaException.php | 2 +- src/Exceptions/InvalidScopeException.php | 2 +- src/Exceptions/InvalidSecretException.php | 2 +- src/Exceptions/MethodNotAllowedException.php | 2 +- src/Exceptions/MissingHeaderException.php | 2 +- src/Exceptions/MissingScopeException.php | 2 +- src/Exceptions/MissingTokenException.php | 2 +- src/Exceptions/NotFoundException.php | 2 +- src/Exceptions/RelationshipCannotBeModifiedException.php | 2 +- src/Exceptions/ResourceCannotBeModifiedException.php | 2 +- src/Exceptions/ResourceConflictException.php | 2 +- src/Exceptions/ResourceHandledBy3rdPartyException.php | 2 +- src/Exceptions/ResourceNotFoundException.php | 2 +- src/Exceptions/TooManyRequestsException.php | 2 +- src/Exceptions/UnprocessableEntityException.php | 2 +- src/Http/UrlBuilder.php | 2 +- 26 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/Errors/GenericCarrierError.php b/src/Errors/GenericCarrierError.php index ae08a19..0f1498b 100644 --- a/src/Errors/GenericCarrierError.php +++ b/src/Errors/GenericCarrierError.php @@ -9,7 +9,7 @@ */ class GenericCarrierError extends AbstractCarrierError { - public function __construct(string $errorCode, string $detail, string $pointer = null) + public function __construct(string $errorCode, string $detail, ?string $pointer = null) { parent::__construct($errorCode, 'Generic carrier error', $detail, $pointer); } diff --git a/src/Errors/InvalidInputContextError.php b/src/Errors/InvalidInputContextError.php index f84910c..2ad5787 100644 --- a/src/Errors/InvalidInputContextError.php +++ b/src/Errors/InvalidInputContextError.php @@ -11,7 +11,7 @@ */ class InvalidInputContextError extends AbstractCarrierError { - public function __construct(string $errorCode, string $detail, string $pointer = null) + public function __construct(string $errorCode, string $detail, ?string $pointer = null) { parent::__construct($errorCode, 'Invalid input context', $detail, $pointer); } diff --git a/src/Errors/InvalidInputError.php b/src/Errors/InvalidInputError.php index 99786d1..c12127e 100644 --- a/src/Errors/InvalidInputError.php +++ b/src/Errors/InvalidInputError.php @@ -10,7 +10,7 @@ */ class InvalidInputError extends AbstractCarrierError { - public function __construct(string $errorCode, string $detail, string $pointer = null) + public function __construct(string $errorCode, string $detail, ?string $pointer = null) { parent::__construct($errorCode, 'Invalid input', $detail, $pointer); } diff --git a/src/Errors/MissingInputError.php b/src/Errors/MissingInputError.php index 34be5b4..d2e4811 100644 --- a/src/Errors/MissingInputError.php +++ b/src/Errors/MissingInputError.php @@ -10,7 +10,7 @@ */ class MissingInputError extends AbstractCarrierError { - public function __construct(string $errorCode, string $detail, string $pointer = null) + public function __construct(string $errorCode, string $detail, ?string $pointer = null) { parent::__construct($errorCode, 'Missing input', $detail, $pointer); } diff --git a/src/Exceptions/AuthException.php b/src/Exceptions/AuthException.php index 9d912f6..5de5201 100644 --- a/src/Exceptions/AuthException.php +++ b/src/Exceptions/AuthException.php @@ -11,7 +11,7 @@ */ class AuthException extends AbstractException { - public function __construct(string $detail, int $status, Throwable $previous = null) + public function __construct(string $detail, int $status, ?Throwable $previous = null) { parent::__construct( $detail, diff --git a/src/Exceptions/CarrierApiException.php b/src/Exceptions/CarrierApiException.php index 0f56fdd..238ca56 100644 --- a/src/Exceptions/CarrierApiException.php +++ b/src/Exceptions/CarrierApiException.php @@ -11,7 +11,7 @@ */ class CarrierApiException extends AbstractException { - public function __construct(int $status, array $carrierApiResponse, Throwable $previous = null) + public function __construct(int $status, array $carrierApiResponse, ?Throwable $previous = null) { parent::__construct( 'There was a problem with the request to the carrier. The original response can be found in the meta under `carrier_response`.', diff --git a/src/Exceptions/ExternalRequestException.php b/src/Exceptions/ExternalRequestException.php index a717c02..490f34a 100644 --- a/src/Exceptions/ExternalRequestException.php +++ b/src/Exceptions/ExternalRequestException.php @@ -11,7 +11,7 @@ */ class ExternalRequestException extends AbstractException { - public function __construct(int $status, int $externalStatus, array $externalError = [], Throwable $previous = null) + public function __construct(int $status, int $externalStatus, array $externalError = [], ?Throwable $previous = null) { parent::__construct( 'An error occurred while making a request to an external service. When available, details can be found in the meta of this request. If the problem persists, please contact support.', diff --git a/src/Exceptions/ForbiddenException.php b/src/Exceptions/ForbiddenException.php index 8dd800b..67c032a 100644 --- a/src/Exceptions/ForbiddenException.php +++ b/src/Exceptions/ForbiddenException.php @@ -13,7 +13,7 @@ */ class ForbiddenException extends AbstractException { - public function __construct(string $message = null, Throwable $previous = null) + public function __construct(?string $message = null, ?Throwable $previous = null) { parent::__construct( $message ?? 'This user is not allowed to perform this action.', diff --git a/src/Exceptions/InvalidAccessTokenException.php b/src/Exceptions/InvalidAccessTokenException.php index 7b5d068..b0ca004 100644 --- a/src/Exceptions/InvalidAccessTokenException.php +++ b/src/Exceptions/InvalidAccessTokenException.php @@ -12,7 +12,7 @@ */ class InvalidAccessTokenException extends AbstractException { - public function __construct(string $detail, Throwable $previous = null) + public function __construct(string $detail, ?Throwable $previous = null) { parent::__construct( $detail, diff --git a/src/Exceptions/InvalidExternalErrorException.php b/src/Exceptions/InvalidExternalErrorException.php index b802eff..45d35d1 100644 --- a/src/Exceptions/InvalidExternalErrorException.php +++ b/src/Exceptions/InvalidExternalErrorException.php @@ -12,7 +12,7 @@ */ class InvalidExternalErrorException extends AbstractException { - public function __construct(Throwable $previous = null) + public function __construct(?Throwable $previous = null) { parent::__construct( 'An error was thrown during the request to the external source. We cannot provide more information since the returned error was improperly formatted.', diff --git a/src/Exceptions/InvalidJsonSchemaException.php b/src/Exceptions/InvalidJsonSchemaException.php index 8c769f9..5d4f7f3 100644 --- a/src/Exceptions/InvalidJsonSchemaException.php +++ b/src/Exceptions/InvalidJsonSchemaException.php @@ -12,7 +12,7 @@ */ class InvalidJsonSchemaException extends AbstractException { - public function __construct(array $errors, Throwable $previous = null) + public function __construct(array $errors, ?Throwable $previous = null) { parent::__construct( 'The supplied data is invalid according to our API Specification. See meta for details.', diff --git a/src/Exceptions/InvalidScopeException.php b/src/Exceptions/InvalidScopeException.php index ed4f9e6..97259e0 100644 --- a/src/Exceptions/InvalidScopeException.php +++ b/src/Exceptions/InvalidScopeException.php @@ -16,7 +16,7 @@ class InvalidScopeException extends AbstractException { use EnumTrait; - public function __construct(array $scopeSlugs, Throwable $previous = null) + public function __construct(array $scopeSlugs, ?Throwable $previous = null) { $scopeStrings = collect($scopeSlugs) ->map(fn (mixed $scopeSlug) => $this->getEnumValue($scopeSlug)) diff --git a/src/Exceptions/InvalidSecretException.php b/src/Exceptions/InvalidSecretException.php index 4cd9526..b3fff26 100644 --- a/src/Exceptions/InvalidSecretException.php +++ b/src/Exceptions/InvalidSecretException.php @@ -12,7 +12,7 @@ */ class InvalidSecretException extends AbstractException { - public function __construct(Throwable $previous = null) + public function __construct(?Throwable $previous = null) { parent::__construct( 'The provided secret is invalid. Please try again later. If the problem persists, contact customer support.', diff --git a/src/Exceptions/MethodNotAllowedException.php b/src/Exceptions/MethodNotAllowedException.php index 59a0b35..ceba888 100644 --- a/src/Exceptions/MethodNotAllowedException.php +++ b/src/Exceptions/MethodNotAllowedException.php @@ -15,7 +15,7 @@ */ class MethodNotAllowedException extends AbstractException { - public function __construct(string $httpMethod, Throwable $previous = null) + public function __construct(string $httpMethod, ?Throwable $previous = null) { $httpMethod = strtoupper($httpMethod); parent::__construct( diff --git a/src/Exceptions/MissingHeaderException.php b/src/Exceptions/MissingHeaderException.php index 4b3d07c..1728056 100644 --- a/src/Exceptions/MissingHeaderException.php +++ b/src/Exceptions/MissingHeaderException.php @@ -9,7 +9,7 @@ class MissingHeaderException extends AbstractException { - public function __construct(array $headers, Throwable $previous = null) + public function __construct(array $headers, ?Throwable $previous = null) { parent::__construct( 'The request does not contain the required header(s): ' . implode(', ', $headers) . '.', diff --git a/src/Exceptions/MissingScopeException.php b/src/Exceptions/MissingScopeException.php index bc6a4ac..39478e1 100644 --- a/src/Exceptions/MissingScopeException.php +++ b/src/Exceptions/MissingScopeException.php @@ -12,7 +12,7 @@ class MissingScopeException extends AbstractException { use EnumTrait; - public function __construct(array $scopeSlugs, Throwable $previous = null) + public function __construct(array $scopeSlugs, ?Throwable $previous = null) { $scopeStrings = collect($scopeSlugs) ->map(fn (mixed $scopeSlug) => $this->getEnumValue($scopeSlug)) diff --git a/src/Exceptions/MissingTokenException.php b/src/Exceptions/MissingTokenException.php index c056e2d..d302e6f 100644 --- a/src/Exceptions/MissingTokenException.php +++ b/src/Exceptions/MissingTokenException.php @@ -9,7 +9,7 @@ class MissingTokenException extends AbstractException { - public function __construct(Throwable $previous = null) + public function __construct(?Throwable $previous = null) { parent::__construct( 'No access token was provided for the request. Please add this to the \'Authorization: Bearer\' header.', diff --git a/src/Exceptions/NotFoundException.php b/src/Exceptions/NotFoundException.php index c09cd1e..d1fc2e4 100644 --- a/src/Exceptions/NotFoundException.php +++ b/src/Exceptions/NotFoundException.php @@ -12,7 +12,7 @@ */ class NotFoundException extends AbstractException { - public function __construct(string $detail, Throwable $previous = null) + public function __construct(string $detail, ?Throwable $previous = null) { parent::__construct( $detail, diff --git a/src/Exceptions/RelationshipCannotBeModifiedException.php b/src/Exceptions/RelationshipCannotBeModifiedException.php index 3629a5a..c4b8c7d 100644 --- a/src/Exceptions/RelationshipCannotBeModifiedException.php +++ b/src/Exceptions/RelationshipCannotBeModifiedException.php @@ -13,7 +13,7 @@ class RelationshipCannotBeModifiedException extends AbstractException { use EnumTrait; - public function __construct(UnitEnum|string $relationshipType, Throwable $previous = null) + public function __construct(UnitEnum|string $relationshipType, ?Throwable $previous = null) { parent::__construct( sprintf( diff --git a/src/Exceptions/ResourceCannotBeModifiedException.php b/src/Exceptions/ResourceCannotBeModifiedException.php index 9b75ed2..f2ba51a 100644 --- a/src/Exceptions/ResourceCannotBeModifiedException.php +++ b/src/Exceptions/ResourceCannotBeModifiedException.php @@ -9,7 +9,7 @@ class ResourceCannotBeModifiedException extends AbstractException { - public function __construct(string $message, Throwable $previous = null) + public function __construct(string $message, ?Throwable $previous = null) { parent::__construct( $message, diff --git a/src/Exceptions/ResourceConflictException.php b/src/Exceptions/ResourceConflictException.php index b87c6c8..f5333fc 100644 --- a/src/Exceptions/ResourceConflictException.php +++ b/src/Exceptions/ResourceConflictException.php @@ -12,7 +12,7 @@ */ class ResourceConflictException extends AbstractException { - public function __construct(string $field, Throwable $previous = null) + public function __construct(string $field, ?Throwable $previous = null) { parent::__construct( "The supplied resource `$field` is invalid.", diff --git a/src/Exceptions/ResourceHandledBy3rdPartyException.php b/src/Exceptions/ResourceHandledBy3rdPartyException.php index 0cf1061..ee82b77 100644 --- a/src/Exceptions/ResourceHandledBy3rdPartyException.php +++ b/src/Exceptions/ResourceHandledBy3rdPartyException.php @@ -13,7 +13,7 @@ class ResourceHandledBy3rdPartyException extends AbstractException { use EnumTrait; - public function __construct(UnitEnum|string $resourceType, string $platform, Throwable $previous = null) + public function __construct(UnitEnum|string $resourceType, string $platform, ?Throwable $previous = null) { parent::__construct( sprintf('One or more of the %s resource is handled by a 3rd party.', $this->getEnumValue($resourceType)), diff --git a/src/Exceptions/ResourceNotFoundException.php b/src/Exceptions/ResourceNotFoundException.php index 3f983d3..6aa772f 100644 --- a/src/Exceptions/ResourceNotFoundException.php +++ b/src/Exceptions/ResourceNotFoundException.php @@ -13,7 +13,7 @@ class ResourceNotFoundException extends AbstractException { use EnumTrait; - public function __construct(UnitEnum|string $resourceType, Throwable $previous = null) + public function __construct(UnitEnum|string $resourceType, ?Throwable $previous = null) { parent::__construct( sprintf('One or more of the %s resource could not be found.', $this->getEnumValue($resourceType)), diff --git a/src/Exceptions/TooManyRequestsException.php b/src/Exceptions/TooManyRequestsException.php index 71aaea6..6a7d704 100644 --- a/src/Exceptions/TooManyRequestsException.php +++ b/src/Exceptions/TooManyRequestsException.php @@ -12,7 +12,7 @@ */ class TooManyRequestsException extends AbstractException { - public function __construct(string $detail, Throwable $previous = null) + public function __construct(string $detail, ?Throwable $previous = null) { parent::__construct( $detail, diff --git a/src/Exceptions/UnprocessableEntityException.php b/src/Exceptions/UnprocessableEntityException.php index 78f3382..46c0c5a 100644 --- a/src/Exceptions/UnprocessableEntityException.php +++ b/src/Exceptions/UnprocessableEntityException.php @@ -13,7 +13,7 @@ */ class UnprocessableEntityException extends AbstractException { - public function __construct(string $detail, Throwable $previous = null) + public function __construct(string $detail, ?Throwable $previous = null) { parent::__construct( $detail, diff --git a/src/Http/UrlBuilder.php b/src/Http/UrlBuilder.php index d8029c8..76426d0 100644 --- a/src/Http/UrlBuilder.php +++ b/src/Http/UrlBuilder.php @@ -24,7 +24,7 @@ class UrlBuilder protected ?string $fragment = null; - public function __construct(string $url = null) + public function __construct(?string $url = null) { if ($url !== null) { $this->setUrl($url);