Skip to content

Commit

Permalink
upgrades to support symfony 7.x
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaEstes committed Feb 29, 2024
1 parent 22926e5 commit 3263826
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,20 @@ class AggregateIdNormalizer implements NormalizerInterface, DenormalizerInterfac
/**
* @return string
*/
public function normalize($object, string $format = null, array $context = [])
public function normalize(mixed $object, ?string $format = null, array $context = []): \ArrayObject|array|string|int|float|bool|null
{
return (string) $object;
}

public function supportsNormalization($data, string $format = null, array $context = []): bool
public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool
{
return $data instanceof AggregateIdInterface;
}

/**
* @return AggregateIdInterface
*/
public function denormalize($data, string $type, string $format = null, array $context = [])
public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed
{
if (AggregateIdInterface::class === $type) {
return new AggregateId($data);
Expand All @@ -50,7 +50,7 @@ public function denormalize($data, string $type, string $format = null, array $c
return $type::fromString($data);
}

public function supportsDenormalization($data, string $type, string $format = null, array $context = []): bool
public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool
{
return is_a($type, AggregateIdInterface::class, true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,20 @@ class AggregateVersionNormalizer implements NormalizerInterface, DenormalizerInt
/**
* @return int
*/
public function normalize($object, string $format = null, array $context = [])
public function normalize(mixed $object, ?string $format = null, array $context = []): \ArrayObject|array|string|int|float|bool|null
{
return $object->toInt();
}

public function supportsNormalization($data, string $format = null, array $context = []): bool
public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool
{
return $data instanceof AggregateVersionInterface;
}

/**
* @return AggregateVersionInterface
*/
public function denormalize($data, string $type, string $format = null, array $context = [])
public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed
{
if (AggregateVersionInterface::class === $type) {
return new AggregateVersion($data);
Expand All @@ -50,7 +50,7 @@ public function denormalize($data, string $type, string $format = null, array $c
return $type::fromInt($data);
}

public function supportsDenormalization($data, string $type, string $format = null, array $context = []): bool
public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool
{
return is_a($type, AggregateVersionInterface::class, true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,28 @@ class MessageNormalizer implements NormalizerInterface, DenormalizerInterface
/**
* @return array
*/
public function normalize($object, string $format = null, array $context = [])
public function normalize(mixed $object, ?string $format = null, array $context = []): \ArrayObject|array|string|int|float|bool|null
{
return [
'payload' => $object->getPayload(),
'metadata' => $object->getMetadata(),
];
}

public function supportsNormalization($data, string $format = null, array $context = []): bool
public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool
{
return $data instanceof MessageInterface;
}

/**
* @return MessageInterface
*/
public function denormalize($data, string $type, string $format = null, array $context = [])
public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed
{
return $type::new()->withPayload($data['payload'])->withMetadata($data['metadata']);
}

public function supportsDenormalization($data, string $type, string $format = null, array $context = []): bool
public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool
{
if (false === \is_array($data)) {
return false;
Expand Down

0 comments on commit 3263826

Please sign in to comment.