From 1ef0a63fcc5df0e9277a8db4a8aeec17c5619800 Mon Sep 17 00:00:00 2001 From: Tac Tacelosky Date: Sun, 15 Dec 2024 16:21:29 -0500 Subject: [PATCH] explicitly declare implicit nullable parameter declarations --- src/DataCollector/PwaCollector.php | 2 +- src/Normalizer/AssetNormalizer.php | 8 ++++---- src/Normalizer/IconNormalizer.php | 4 ++-- src/Normalizer/ScreenshotNormalizer.php | 4 ++-- src/Normalizer/ServiceWorkerNormalizer.php | 4 ++-- src/Normalizer/UrlNormalizer.php | 4 ++-- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/DataCollector/PwaCollector.php b/src/DataCollector/PwaCollector.php index 0fb7862..ddf3916 100644 --- a/src/DataCollector/PwaCollector.php +++ b/src/DataCollector/PwaCollector.php @@ -48,7 +48,7 @@ public function __construct( ) { } - public function collect(Request $request, Response $response, Throwable $exception = null): void + public function collect(Request $request, Response $response, ?Throwable $exception = null): void { $jsonOptions = [ AbstractObjectNormalizer::SKIP_UNINITIALIZED_VALUES => true, diff --git a/src/Normalizer/AssetNormalizer.php b/src/Normalizer/AssetNormalizer.php index 5521de7..a01cc65 100644 --- a/src/Normalizer/AssetNormalizer.php +++ b/src/Normalizer/AssetNormalizer.php @@ -21,7 +21,7 @@ public function __construct( /** * @return array{src: string, sizes?: string, form_factor?: string, label?: string, platform?: string, format?: string} */ - public function normalize(mixed $object, string $format = null, array $context = []): string + public function normalize(mixed $object, ?string $format = null, array $context = []): string { assert($object instanceof Asset); $url = null; @@ -36,14 +36,14 @@ public function normalize(mixed $object, string $format = null, array $context = return $url; } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { assert(is_string($data)); return Asset::create($data); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { return $data instanceof Asset; } @@ -51,7 +51,7 @@ public function supportsNormalization(mixed $data, string $format = null, array public function supportsDenormalization( mixed $data, string $type, - string $format = null, + ?string $format = null, array $context = [] ): bool { return $type === Asset::class; diff --git a/src/Normalizer/IconNormalizer.php b/src/Normalizer/IconNormalizer.php index e9a10ef..7e1aa31 100644 --- a/src/Normalizer/IconNormalizer.php +++ b/src/Normalizer/IconNormalizer.php @@ -23,7 +23,7 @@ public function __construct( /** * @return array{src: string, sizes?: string, type?: string, purpose?: string} */ - public function normalize(mixed $object, string $format = null, array $context = []): array + public function normalize(mixed $object, ?string $format = null, array $context = []): array { assert($object instanceof Icon); $icon = $this->iconResolver->getIcon($object); @@ -44,7 +44,7 @@ public function normalize(mixed $object, string $format = null, array $context = return $cleanup($result); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { return $data instanceof Icon; } diff --git a/src/Normalizer/ScreenshotNormalizer.php b/src/Normalizer/ScreenshotNormalizer.php index f816a1e..c68deba 100644 --- a/src/Normalizer/ScreenshotNormalizer.php +++ b/src/Normalizer/ScreenshotNormalizer.php @@ -28,7 +28,7 @@ public function __construct( /** * @return array{src: string, sizes?: string, form_factor?: string, label?: string, platform?: string, format?: string} */ - public function normalize(mixed $object, string $format = null, array $context = []): array + public function normalize(mixed $object, ?string $format = null, array $context = []): array { assert($object instanceof Screenshot); $asset = null; @@ -55,7 +55,7 @@ public function normalize(mixed $object, string $format = null, array $context = return $cleanup($result); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { return $data instanceof Screenshot; } diff --git a/src/Normalizer/ServiceWorkerNormalizer.php b/src/Normalizer/ServiceWorkerNormalizer.php index c9d11a8..0983df1 100644 --- a/src/Normalizer/ServiceWorkerNormalizer.php +++ b/src/Normalizer/ServiceWorkerNormalizer.php @@ -13,7 +13,7 @@ /** * @return array{scope?: string, src: string, use_cache?: bool} */ - public function normalize(mixed $object, string $format = null, array $context = []): array + public function normalize(mixed $object, ?string $format = null, array $context = []): array { assert($object instanceof ServiceWorker); @@ -30,7 +30,7 @@ public function normalize(mixed $object, string $format = null, array $context = return $cleanup($result); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { return $data instanceof ServiceWorker; } diff --git a/src/Normalizer/UrlNormalizer.php b/src/Normalizer/UrlNormalizer.php index e373fef..8961c5a 100644 --- a/src/Normalizer/UrlNormalizer.php +++ b/src/Normalizer/UrlNormalizer.php @@ -24,7 +24,7 @@ public function __construct( ) { } - public function normalize(mixed $object, string $format = null, array $context = []): string + public function normalize(mixed $object, ?string $format = null, array $context = []): string { assert($object instanceof Url); @@ -48,7 +48,7 @@ public function normalize(mixed $object, string $format = null, array $context = } } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { return $data instanceof Url; }