Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrades to support symfony 7.x #209

Merged
merged 1 commit into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading