Skip to content

Commit

Permalink
explicitly declare implicit nullable parameter declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
tacman committed Dec 15, 2024
1 parent 7dd44c2 commit 1ef0a63
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/DataCollector/PwaCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions src/Normalizer/AssetNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -36,22 +36,22 @@ 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;
}

public function supportsDenormalization(
mixed $data,
string $type,
string $format = null,
?string $format = null,
array $context = []
): bool {
return $type === Asset::class;
Expand Down
4 changes: 2 additions & 2 deletions src/Normalizer/IconNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Normalizer/ScreenshotNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Normalizer/ServiceWorkerNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Normalizer/UrlNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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;
}
Expand Down

0 comments on commit 1ef0a63

Please sign in to comment.