From 3263826d137d545e1f3cdaffd2a27845aeda8d38 Mon Sep 17 00:00:00 2001 From: Joshua Estes Date: Thu, 29 Feb 2024 15:34:23 -0500 Subject: [PATCH] upgrades to support symfony 7.x --- .../EventSourcing/Aggregate/AggregateIdNormalizer.php | 8 ++++---- .../Aggregate/AggregateVersionNormalizer.php | 8 ++++---- .../Symfony/EventSourcing/Message/MessageNormalizer.php | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/SonsOfPHP/Bridge/Symfony/EventSourcing/Aggregate/AggregateIdNormalizer.php b/src/SonsOfPHP/Bridge/Symfony/EventSourcing/Aggregate/AggregateIdNormalizer.php index 166c629c..37be0cad 100644 --- a/src/SonsOfPHP/Bridge/Symfony/EventSourcing/Aggregate/AggregateIdNormalizer.php +++ b/src/SonsOfPHP/Bridge/Symfony/EventSourcing/Aggregate/AggregateIdNormalizer.php @@ -28,12 +28,12 @@ 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; } @@ -41,7 +41,7 @@ public function supportsNormalization($data, string $format = null, array $conte /** * @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); @@ -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); } diff --git a/src/SonsOfPHP/Bridge/Symfony/EventSourcing/Aggregate/AggregateVersionNormalizer.php b/src/SonsOfPHP/Bridge/Symfony/EventSourcing/Aggregate/AggregateVersionNormalizer.php index 649224c7..7b9bb8e7 100644 --- a/src/SonsOfPHP/Bridge/Symfony/EventSourcing/Aggregate/AggregateVersionNormalizer.php +++ b/src/SonsOfPHP/Bridge/Symfony/EventSourcing/Aggregate/AggregateVersionNormalizer.php @@ -28,12 +28,12 @@ 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; } @@ -41,7 +41,7 @@ public function supportsNormalization($data, string $format = null, array $conte /** * @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); @@ -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); } diff --git a/src/SonsOfPHP/Bridge/Symfony/EventSourcing/Message/MessageNormalizer.php b/src/SonsOfPHP/Bridge/Symfony/EventSourcing/Message/MessageNormalizer.php index a99a597a..153a1f3d 100644 --- a/src/SonsOfPHP/Bridge/Symfony/EventSourcing/Message/MessageNormalizer.php +++ b/src/SonsOfPHP/Bridge/Symfony/EventSourcing/Message/MessageNormalizer.php @@ -25,7 +25,7 @@ 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(), @@ -33,7 +33,7 @@ public function normalize($object, string $format = null, array $context = []) ]; } - 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; } @@ -41,12 +41,12 @@ public function supportsNormalization($data, string $format = null, array $conte /** * @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;