Skip to content

Commit

Permalink
Fix OrderedSerializer compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-schranz committed Jul 16, 2024
1 parent 4355081 commit e899a98
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/Serializer/OrderedSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,15 @@ public function __construct(array $normalizers = [])
$this->serializer = new Serializer($normalizers);
}

public function getSupportedTypes(?string $format): array
{
return ['*' => true];
}

/**
* {@inheritdoc}
*/
public function normalize($data, $format = null, array $context = [])
public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
{
return $this->serializer->normalize(
is_array($data) ? $this->order($data) : $data,
Expand All @@ -49,7 +54,7 @@ public function normalize($data, $format = null, array $context = [])
/**
* {@inheritdoc}
*/
public function denormalize($data, $type, $format = null, array $context = [])
public function denormalize($data, $type, $format = null, array $context = []): mixed
{
return $this->serializer->denormalize(
is_array($data) ? $this->order($data) : $data,
Expand Down Expand Up @@ -104,15 +109,15 @@ function ($value) {
/**
* {@inheritdoc}
*/
public function supportsDenormalization($data, $type, $format = null)
public function supportsDenormalization($data, $type, $format = null, array $context = []): bool
{
return $this->serializer->supportsDenormalization($data, $format);
}

/**
* {@inheritdoc}
*/
public function supportsNormalization($data, $format = null)
public function supportsNormalization($data, $format = null, array $context = []): bool
{
return $this->serializer->supportsNormalization($data, $format);
}
Expand Down

0 comments on commit e899a98

Please sign in to comment.