Skip to content

Commit

Permalink
stop marking parameters implicitly as nullable
Browse files Browse the repository at this point in the history
  • Loading branch information
xabbuh committed Mar 27, 2024
1 parent 8b83945 commit 3697adf
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Tests/Fixtures/FooInterfaceDummyDenormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

final class FooInterfaceDummyDenormalizer implements DenormalizerInterface
{
public function denormalize(mixed $data, string $type, string $format = null, array $context = []): array
public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): array
{
$result = [];
foreach ($data as $foo) {
Expand All @@ -27,7 +27,7 @@ public function denormalize(mixed $data, string $type, string $format = null, ar
return $result;
}

public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool
public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool
{
if (str_ends_with($type, '[]')) {
$className = substr($type, 0, -2);
Expand Down
2 changes: 1 addition & 1 deletion Tests/Fixtures/FormatAndContextAwareNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

class FormatAndContextAwareNormalizer extends ObjectNormalizer
{
protected function isAllowedAttribute($classOrObject, string $attribute, string $format = null, array $context = []): bool
protected function isAllowedAttribute($classOrObject, string $attribute, ?string $format = null, array $context = []): bool
{
return \in_array($attribute, ['foo', 'bar']) && 'foo_and_bar_included' === $format;
}
Expand Down
6 changes: 3 additions & 3 deletions Tests/Fixtures/StaticConstructorNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ public function getSupportedTypes(?string $format): array
return [StaticConstructorDummy::class];
}

protected function extractAttributes(object $object, string $format = null, array $context = []): array
protected function extractAttributes(object $object, ?string $format = null, array $context = []): array
{
return get_object_vars($object);
}

protected function getAttributeValue(object $object, string $attribute, string $format = null, array $context = []): mixed
protected function getAttributeValue(object $object, string $attribute, ?string $format = null, array $context = []): mixed
{
return $object->$attribute;
}

protected function setAttributeValue(object $object, string $attribute, mixed $value, string $format = null, array $context = []): void
protected function setAttributeValue(object $object, string $attribute, mixed $value, ?string $format = null, array $context = []): void
{
$object->$attribute = $value;
}
Expand Down

0 comments on commit 3697adf

Please sign in to comment.