Skip to content

Commit

Permalink
fix(serializer): Remove ItemNormalizer wrong return type
Browse files Browse the repository at this point in the history
  • Loading branch information
n-valverde committed Oct 4, 2023
1 parent fb8cfef commit af85fba
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Elasticsearch/Serializer/ItemNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function supportsDenormalization($data, $type, $format = null, array $con
/**
* {@inheritdoc}
*/
public function normalize($object, $format = null, array $context = []): array
public function normalize($object, $format = null, array $context = [])
{
return $this->decorated->normalize($object, $format, $context);
}
Expand Down
7 changes: 7 additions & 0 deletions tests/Elasticsearch/Serializer/ItemNormalizerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ public function testNormalize(): void
self::assertSame(['foo'], $this->itemNormalizer->normalize($object, 'json', ['groups' => 'foo']));
}

public function testNormalizeToString(): void
{
$this->normalizerProphecy->normalize($object = (object) ['foo'], 'json', ['groups' => 'foo'])->willReturn('/foo/iri')->shouldBeCalledOnce();

self::assertSame('/foo/iri', $this->itemNormalizer->normalize($object, 'json', ['groups' => 'foo']));
}

public function testSupportsNormalization(): void
{
$this->normalizerProphecy->supportsNormalization($object = (object) ['foo'], 'json')->willReturn(true)->shouldBeCalledOnce();
Expand Down

0 comments on commit af85fba

Please sign in to comment.