diff --git a/src/Elasticsearch/Serializer/ItemNormalizer.php b/src/Elasticsearch/Serializer/ItemNormalizer.php index cad183402f3..9b49a40ab73 100644 --- a/src/Elasticsearch/Serializer/ItemNormalizer.php +++ b/src/Elasticsearch/Serializer/ItemNormalizer.php @@ -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); } diff --git a/tests/Elasticsearch/Serializer/ItemNormalizerTest.php b/tests/Elasticsearch/Serializer/ItemNormalizerTest.php index 57982f8f8b2..d4d8429c652 100644 --- a/tests/Elasticsearch/Serializer/ItemNormalizerTest.php +++ b/tests/Elasticsearch/Serializer/ItemNormalizerTest.php @@ -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();