From cda684d4761f1b0dd3e79f99cd755cb642efb157 Mon Sep 17 00:00:00 2001 From: "pierre.rebeilleau" Date: Tue, 26 Oct 2021 16:12:33 +0200 Subject: [PATCH 1/2] fix: symfony 5.4 type hint compatibility --- .../Elasticsearch/Serializer/DocumentNormalizer.php | 2 +- .../Bridge/Elasticsearch/Serializer/ItemNormalizer.php | 8 +++++--- .../Symfony/Identifier/Normalizer/UuidNormalizer.php | 5 ++++- src/Core/Hal/Serializer/EntrypointNormalizer.php | 2 +- src/Core/Hal/Serializer/ItemNormalizer.php | 1 + src/Core/Hal/Serializer/ObjectNormalizer.php | 1 + src/Core/Hydra/Serializer/CollectionFiltersNormalizer.php | 2 +- src/Core/Hydra/Serializer/CollectionNormalizer.php | 2 +- .../Serializer/ConstraintViolationListNormalizer.php | 2 +- src/Core/Hydra/Serializer/DocumentationNormalizer.php | 2 +- src/Core/Hydra/Serializer/EntrypointNormalizer.php | 2 +- src/Core/Hydra/Serializer/ErrorNormalizer.php | 2 +- .../Hydra/Serializer/PartialCollectionViewNormalizer.php | 2 +- .../Serializer/ConstraintViolationListNormalizer.php | 2 +- src/Core/JsonApi/Serializer/EntrypointNormalizer.php | 2 +- src/Core/JsonApi/Serializer/ErrorNormalizer.php | 2 +- src/Core/JsonApi/Serializer/ItemNormalizer.php | 2 ++ src/Core/JsonApi/Serializer/ObjectNormalizer.php | 2 ++ src/Core/JsonLd/Serializer/ItemNormalizer.php | 2 ++ src/Core/JsonLd/Serializer/ObjectNormalizer.php | 2 ++ .../Serializer/ConstraintViolationListNormalizer.php | 2 +- src/Core/Problem/Serializer/ErrorNormalizer.php | 2 +- src/Core/Serializer/AbstractCollectionNormalizer.php | 2 +- src/Core/Serializer/AbstractItemNormalizer.php | 4 ++++ src/Core/Swagger/Serializer/ApiGatewayNormalizer.php | 2 ++ src/Core/Swagger/Serializer/DocumentationNormalizer.php | 2 +- src/GraphQl/Serializer/ItemNormalizer.php | 4 ++++ src/GraphQl/Serializer/ObjectNormalizer.php | 2 +- src/Symfony/Bundle/Command/DebugResourceCommand.php | 2 +- .../Denormalizer/DummyPlainIdentifierDenormalizer.php | 2 ++ .../RelatedDummyPlainIdentifierDenormalizer.php | 2 ++ .../Normalizer/OverrideDocumentationNormalizer.php | 7 +++++++ 32 files changed, 58 insertions(+), 22 deletions(-) diff --git a/src/Core/Bridge/Elasticsearch/Serializer/DocumentNormalizer.php b/src/Core/Bridge/Elasticsearch/Serializer/DocumentNormalizer.php index a2bbf49e8cc..cf0603c546e 100644 --- a/src/Core/Bridge/Elasticsearch/Serializer/DocumentNormalizer.php +++ b/src/Core/Bridge/Elasticsearch/Serializer/DocumentNormalizer.php @@ -78,7 +78,7 @@ public function supportsNormalization($data, $format = null): bool * * @throws LogicException */ - public function normalize($object, $format = null, array $context = []) + public function normalize($object, $format = null, array $context = []): array { throw new LogicException(sprintf('%s is a write-only format.', self::FORMAT)); } diff --git a/src/Core/Bridge/Elasticsearch/Serializer/ItemNormalizer.php b/src/Core/Bridge/Elasticsearch/Serializer/ItemNormalizer.php index f38d19a562d..dcefb46432d 100644 --- a/src/Core/Bridge/Elasticsearch/Serializer/ItemNormalizer.php +++ b/src/Core/Bridge/Elasticsearch/Serializer/ItemNormalizer.php @@ -53,6 +53,8 @@ public function hasCacheableSupportsMethod(): bool * {@inheritdoc} * * @throws LogicException + * + * @return mixed */ public function denormalize($data, $type, $format = null, array $context = []) { @@ -68,7 +70,7 @@ public function denormalize($data, $type, $format = null, array $context = []) * * @throws LogicException */ - public function supportsDenormalization($data, $type, $format = null) + public function supportsDenormalization($data, $type, $format = null): bool { if (!$this->decorated instanceof DenormalizerInterface) { throw new LogicException(sprintf('The decorated normalizer must be an instance of "%s".', DenormalizerInterface::class)); @@ -80,7 +82,7 @@ public function supportsDenormalization($data, $type, $format = null) /** * {@inheritdoc} */ - public function normalize($object, $format = null, array $context = []) + public function normalize($object, $format = null, array $context = []): array { return $this->decorated->normalize($object, $format, $context); } @@ -88,7 +90,7 @@ public function normalize($object, $format = null, array $context = []) /** * {@inheritdoc} */ - public function supportsNormalization($data, $format = null) + public function supportsNormalization($data, $format = null): bool { return DocumentNormalizer::FORMAT !== $format && $this->decorated->supportsNormalization($data, $format); } diff --git a/src/Core/Bridge/Symfony/Identifier/Normalizer/UuidNormalizer.php b/src/Core/Bridge/Symfony/Identifier/Normalizer/UuidNormalizer.php index 13a4fce5abc..7d609cd011f 100644 --- a/src/Core/Bridge/Symfony/Identifier/Normalizer/UuidNormalizer.php +++ b/src/Core/Bridge/Symfony/Identifier/Normalizer/UuidNormalizer.php @@ -15,6 +15,7 @@ use ApiPlatform\Exception\InvalidIdentifierException; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; +use Symfony\Component\Uid\AbstractUid; use Symfony\Component\Uid\Uuid; /** @@ -24,6 +25,8 @@ final class UuidNormalizer implements DenormalizerInterface { /** * {@inheritdoc} + * + * @return AbstractUid|Uuid */ public function denormalize($data, $class, $format = null, array $context = []) { @@ -37,7 +40,7 @@ public function denormalize($data, $class, $format = null, array $context = []) /** * {@inheritdoc} */ - public function supportsDenormalization($data, $type, $format = null) + public function supportsDenormalization($data, $type, $format = null): bool { return \is_string($data) && is_a($type, Uuid::class, true); } diff --git a/src/Core/Hal/Serializer/EntrypointNormalizer.php b/src/Core/Hal/Serializer/EntrypointNormalizer.php index 642fa8bfd00..9c3f9e14d02 100644 --- a/src/Core/Hal/Serializer/EntrypointNormalizer.php +++ b/src/Core/Hal/Serializer/EntrypointNormalizer.php @@ -60,7 +60,7 @@ public function __construct($resourceMetadataFactory, $iriConverter, UrlGenerato /** * {@inheritdoc} */ - public function normalize($object, $format = null, array $context = []) + public function normalize($object, $format = null, array $context = []): array { $entrypoint = ['_links' => ['self' => ['href' => $this->urlGenerator->generate('api_entrypoint')]]]; diff --git a/src/Core/Hal/Serializer/ItemNormalizer.php b/src/Core/Hal/Serializer/ItemNormalizer.php index 9e023bb6571..3afa9534a8e 100644 --- a/src/Core/Hal/Serializer/ItemNormalizer.php +++ b/src/Core/Hal/Serializer/ItemNormalizer.php @@ -50,6 +50,7 @@ public function supportsNormalization($data, $format = null): bool /** * {@inheritdoc} + * @return array|string|int|float|bool|\ArrayObject|null */ public function normalize($object, $format = null, array $context = []) { diff --git a/src/Core/Hal/Serializer/ObjectNormalizer.php b/src/Core/Hal/Serializer/ObjectNormalizer.php index b621264ecce..c2e623cc60c 100644 --- a/src/Core/Hal/Serializer/ObjectNormalizer.php +++ b/src/Core/Hal/Serializer/ObjectNormalizer.php @@ -60,6 +60,7 @@ public function hasCacheableSupportsMethod(): bool /** * {@inheritdoc} + * @return array|string|int|float|bool|\ArrayObject|null */ public function normalize($object, $format = null, array $context = []) { diff --git a/src/Core/Hydra/Serializer/CollectionFiltersNormalizer.php b/src/Core/Hydra/Serializer/CollectionFiltersNormalizer.php index e1810c5d0ae..67af32ea151 100644 --- a/src/Core/Hydra/Serializer/CollectionFiltersNormalizer.php +++ b/src/Core/Hydra/Serializer/CollectionFiltersNormalizer.php @@ -74,7 +74,7 @@ public function hasCacheableSupportsMethod(): bool /** * {@inheritdoc} */ - public function normalize($object, $format = null, array $context = []) + public function normalize($object, $format = null, array $context = []): array { $data = $this->collectionNormalizer->normalize($object, $format, $context); if (!\is_array($data)) { diff --git a/src/Core/Hydra/Serializer/CollectionNormalizer.php b/src/Core/Hydra/Serializer/CollectionNormalizer.php index 5f354b79772..4671a5ce06b 100644 --- a/src/Core/Hydra/Serializer/CollectionNormalizer.php +++ b/src/Core/Hydra/Serializer/CollectionNormalizer.php @@ -75,7 +75,7 @@ public function supportsNormalization($data, $format = null): bool * * @param iterable $object */ - public function normalize($object, $format = null, array $context = []) + public function normalize($object, $format = null, array $context = []): array { if (!isset($context['resource_class']) || isset($context['api_sub_level'])) { return $this->normalizeRawCollection($object, $format, $context); diff --git a/src/Core/Hydra/Serializer/ConstraintViolationListNormalizer.php b/src/Core/Hydra/Serializer/ConstraintViolationListNormalizer.php index 8641f4c774d..19d87a899a0 100644 --- a/src/Core/Hydra/Serializer/ConstraintViolationListNormalizer.php +++ b/src/Core/Hydra/Serializer/ConstraintViolationListNormalizer.php @@ -38,7 +38,7 @@ public function __construct(UrlGeneratorInterface $urlGenerator, array $serializ /** * {@inheritdoc} */ - public function normalize($object, $format = null, array $context = []) + public function normalize($object, $format = null, array $context = []): array { [$messages, $violations] = $this->getMessagesAndViolations($object); diff --git a/src/Core/Hydra/Serializer/DocumentationNormalizer.php b/src/Core/Hydra/Serializer/DocumentationNormalizer.php index 0bb4b3be35a..cc5d3580def 100644 --- a/src/Core/Hydra/Serializer/DocumentationNormalizer.php +++ b/src/Core/Hydra/Serializer/DocumentationNormalizer.php @@ -86,7 +86,7 @@ public function __construct($resourceMetadataFactory, PropertyNameCollectionFact /** * {@inheritdoc} */ - public function normalize($object, $format = null, array $context = []) + public function normalize($object, $format = null, array $context = []): array { $classes = []; $entrypointProperties = []; diff --git a/src/Core/Hydra/Serializer/EntrypointNormalizer.php b/src/Core/Hydra/Serializer/EntrypointNormalizer.php index d83b781bfbb..1ce358d0f50 100644 --- a/src/Core/Hydra/Serializer/EntrypointNormalizer.php +++ b/src/Core/Hydra/Serializer/EntrypointNormalizer.php @@ -57,7 +57,7 @@ public function __construct($resourceMetadataFactory, $iriConverter, UrlGenerato /** * {@inheritdoc} */ - public function normalize($object, $format = null, array $context = []) + public function normalize($object, $format = null, array $context = []): array { $entrypoint = [ '@context' => $this->urlGenerator->generate('api_jsonld_context', ['shortName' => 'Entrypoint']), diff --git a/src/Core/Hydra/Serializer/ErrorNormalizer.php b/src/Core/Hydra/Serializer/ErrorNormalizer.php index 158f797163b..c1a09eaf146 100644 --- a/src/Core/Hydra/Serializer/ErrorNormalizer.php +++ b/src/Core/Hydra/Serializer/ErrorNormalizer.php @@ -47,7 +47,7 @@ public function __construct(UrlGeneratorInterface $urlGenerator, bool $debug = f /** * {@inheritdoc} */ - public function normalize($object, $format = null, array $context = []) + public function normalize($object, $format = null, array $context = []): array { $data = [ '@context' => $this->urlGenerator->generate('api_jsonld_context', ['shortName' => 'Error']), diff --git a/src/Core/Hydra/Serializer/PartialCollectionViewNormalizer.php b/src/Core/Hydra/Serializer/PartialCollectionViewNormalizer.php index 726dcc369da..11c86ee6767 100644 --- a/src/Core/Hydra/Serializer/PartialCollectionViewNormalizer.php +++ b/src/Core/Hydra/Serializer/PartialCollectionViewNormalizer.php @@ -56,7 +56,7 @@ public function __construct(NormalizerInterface $collectionNormalizer, string $p /** * {@inheritdoc} */ - public function normalize($object, $format = null, array $context = []) + public function normalize($object, $format = null, array $context = []): array { $data = $this->collectionNormalizer->normalize($object, $format, $context); if (!\is_array($data)) { diff --git a/src/Core/JsonApi/Serializer/ConstraintViolationListNormalizer.php b/src/Core/JsonApi/Serializer/ConstraintViolationListNormalizer.php index 82c679cdabb..7a96cc7416d 100644 --- a/src/Core/JsonApi/Serializer/ConstraintViolationListNormalizer.php +++ b/src/Core/JsonApi/Serializer/ConstraintViolationListNormalizer.php @@ -44,7 +44,7 @@ public function __construct($propertyMetadataFactory, NameConverterInterface $na $this->nameConverter = $nameConverter; } - public function normalize($object, $format = null, array $context = []) + public function normalize($object, $format = null, array $context = []): array { $violations = []; foreach ($object as $violation) { diff --git a/src/Core/JsonApi/Serializer/EntrypointNormalizer.php b/src/Core/JsonApi/Serializer/EntrypointNormalizer.php index 9de2f48a4e7..75a33ea501d 100644 --- a/src/Core/JsonApi/Serializer/EntrypointNormalizer.php +++ b/src/Core/JsonApi/Serializer/EntrypointNormalizer.php @@ -57,7 +57,7 @@ public function __construct($resourceMetadataFactory, $iriConverter, UrlGenerato /** * {@inheritdoc} */ - public function normalize($object, $format = null, array $context = []) + public function normalize($object, $format = null, array $context = []): array { $entrypoint = ['links' => ['self' => $this->urlGenerator->generate('api_entrypoint', [], UrlGeneratorInterface::ABS_URL)]]; diff --git a/src/Core/JsonApi/Serializer/ErrorNormalizer.php b/src/Core/JsonApi/Serializer/ErrorNormalizer.php index 762dd7cf9ce..3de1fe8d903 100644 --- a/src/Core/JsonApi/Serializer/ErrorNormalizer.php +++ b/src/Core/JsonApi/Serializer/ErrorNormalizer.php @@ -42,7 +42,7 @@ public function __construct(bool $debug = false, array $defaultContext = []) $this->defaultContext = array_merge($this->defaultContext, $defaultContext); } - public function normalize($object, $format = null, array $context = []) + public function normalize($object, $format = null, array $context = []): array { $data = [ 'title' => $context[self::TITLE] ?? $this->defaultContext[self::TITLE], diff --git a/src/Core/JsonApi/Serializer/ItemNormalizer.php b/src/Core/JsonApi/Serializer/ItemNormalizer.php index 4c92fafb835..e456bbcfe02 100644 --- a/src/Core/JsonApi/Serializer/ItemNormalizer.php +++ b/src/Core/JsonApi/Serializer/ItemNormalizer.php @@ -66,6 +66,8 @@ public function supportsNormalization($data, $format = null): bool /** * {@inheritdoc} + * + * @return array|string|int|float|bool|\ArrayObject|null */ public function normalize($object, $format = null, array $context = []) { diff --git a/src/Core/JsonApi/Serializer/ObjectNormalizer.php b/src/Core/JsonApi/Serializer/ObjectNormalizer.php index 490697496c4..8c08b03de67 100644 --- a/src/Core/JsonApi/Serializer/ObjectNormalizer.php +++ b/src/Core/JsonApi/Serializer/ObjectNormalizer.php @@ -79,6 +79,8 @@ public function hasCacheableSupportsMethod(): bool /** * {@inheritdoc} + * + * @return array|string|int|float|bool|\ArrayObject|null */ public function normalize($object, $format = null, array $context = []) { diff --git a/src/Core/JsonLd/Serializer/ItemNormalizer.php b/src/Core/JsonLd/Serializer/ItemNormalizer.php index 8fa5f830ee9..e22685495d7 100644 --- a/src/Core/JsonLd/Serializer/ItemNormalizer.php +++ b/src/Core/JsonLd/Serializer/ItemNormalizer.php @@ -69,6 +69,8 @@ public function supportsNormalization($data, $format = null): bool * {@inheritdoc} * * @throws LogicException + * + * @return array|string|int|float|bool|\ArrayObject|null */ public function normalize($object, $format = null, array $context = []) { diff --git a/src/Core/JsonLd/Serializer/ObjectNormalizer.php b/src/Core/JsonLd/Serializer/ObjectNormalizer.php index 5dd7f1291a2..b3d8b6f9283 100644 --- a/src/Core/JsonLd/Serializer/ObjectNormalizer.php +++ b/src/Core/JsonLd/Serializer/ObjectNormalizer.php @@ -63,6 +63,8 @@ public function hasCacheableSupportsMethod(): bool /** * {@inheritdoc} + * + * @return array|string|int|float|bool|\ArrayObject|null */ public function normalize($object, $format = null, array $context = []) { diff --git a/src/Core/Problem/Serializer/ConstraintViolationListNormalizer.php b/src/Core/Problem/Serializer/ConstraintViolationListNormalizer.php index f5900545179..b13232e4880 100644 --- a/src/Core/Problem/Serializer/ConstraintViolationListNormalizer.php +++ b/src/Core/Problem/Serializer/ConstraintViolationListNormalizer.php @@ -44,7 +44,7 @@ public function __construct(array $serializePayloadFields = null, NameConverterI /** * {@inheritdoc} */ - public function normalize($object, $format = null, array $context = []) + public function normalize($object, $format = null, array $context = []): array { [$messages, $violations] = $this->getMessagesAndViolations($object); diff --git a/src/Core/Problem/Serializer/ErrorNormalizer.php b/src/Core/Problem/Serializer/ErrorNormalizer.php index 42053b63565..9faf2942f96 100644 --- a/src/Core/Problem/Serializer/ErrorNormalizer.php +++ b/src/Core/Problem/Serializer/ErrorNormalizer.php @@ -47,7 +47,7 @@ public function __construct(bool $debug = false, array $defaultContext = []) /** * {@inheritdoc} */ - public function normalize($object, $format = null, array $context = []) + public function normalize($object, $format = null, array $context = []): array { $data = [ 'type' => $context[self::TYPE] ?? $this->defaultContext[self::TYPE], diff --git a/src/Core/Serializer/AbstractCollectionNormalizer.php b/src/Core/Serializer/AbstractCollectionNormalizer.php index 85e79e4ef22..f82234fd652 100644 --- a/src/Core/Serializer/AbstractCollectionNormalizer.php +++ b/src/Core/Serializer/AbstractCollectionNormalizer.php @@ -78,7 +78,7 @@ public function hasCacheableSupportsMethod(): bool * * @param iterable $object */ - public function normalize($object, $format = null, array $context = []) + public function normalize($object, $format = null, array $context = []): array { if (!isset($context['resource_class']) || isset($context['api_sub_level'])) { return $this->normalizeRawCollection($object, $format, $context); diff --git a/src/Core/Serializer/AbstractItemNormalizer.php b/src/Core/Serializer/AbstractItemNormalizer.php index cd476e8fda6..af2a6d54f03 100644 --- a/src/Core/Serializer/AbstractItemNormalizer.php +++ b/src/Core/Serializer/AbstractItemNormalizer.php @@ -145,6 +145,8 @@ public function hasCacheableSupportsMethod(): bool * {@inheritdoc} * * @throws LogicException + * + * @return array|string|int|float|bool|\ArrayObject|null */ public function normalize($object, $format = null, array $context = []) { @@ -408,6 +410,8 @@ protected function extractAttributes($object, $format = null, array $context = [ /** * {@inheritdoc} + * + * @return array|bool */ protected function getAllowedAttributes($classOrObject, array $context, $attributesAsString = false) { diff --git a/src/Core/Swagger/Serializer/ApiGatewayNormalizer.php b/src/Core/Swagger/Serializer/ApiGatewayNormalizer.php index f271dbfa081..c7ab8037474 100644 --- a/src/Core/Swagger/Serializer/ApiGatewayNormalizer.php +++ b/src/Core/Swagger/Serializer/ApiGatewayNormalizer.php @@ -45,6 +45,8 @@ public function __construct(NormalizerInterface $documentationNormalizer, $defau * {@inheritdoc} * * @throws UnexpectedValueException + * + * @return array|string|int|float|bool|\ArrayObject|null */ public function normalize($object, $format = null, array $context = []) { diff --git a/src/Core/Swagger/Serializer/DocumentationNormalizer.php b/src/Core/Swagger/Serializer/DocumentationNormalizer.php index c69dabb8228..ed3c1fe125a 100644 --- a/src/Core/Swagger/Serializer/DocumentationNormalizer.php +++ b/src/Core/Swagger/Serializer/DocumentationNormalizer.php @@ -189,7 +189,7 @@ public function __construct($resourceMetadataFactory, PropertyNameCollectionFact /** * {@inheritdoc} */ - public function normalize($object, $format = null, array $context = []) + public function normalize($object, $format = null, array $context = []): array { if ($object instanceof OpenApi) { @trigger_error('Using the swagger DocumentationNormalizer is deprecated in favor of decorating the OpenApiFactory, use the "openapi.backward_compatibility_layer" configuration to change this behavior.', \E_USER_DEPRECATED); diff --git a/src/GraphQl/Serializer/ItemNormalizer.php b/src/GraphQl/Serializer/ItemNormalizer.php index 4a75fa8a398..79c5a92e78c 100644 --- a/src/GraphQl/Serializer/ItemNormalizer.php +++ b/src/GraphQl/Serializer/ItemNormalizer.php @@ -67,6 +67,8 @@ public function supportsNormalization($data, $format = null): bool * {@inheritdoc} * * @throws UnexpectedValueException + * + * @return array|string|int|float|bool|\ArrayObject|null */ public function normalize($object, $format = null, array $context = []) { @@ -110,6 +112,8 @@ public function supportsDenormalization($data, $type, $format = null): bool /** * {@inheritdoc} + * + * @return array|bool */ protected function getAllowedAttributes($classOrObject, array $context, $attributesAsString = false) { diff --git a/src/GraphQl/Serializer/ObjectNormalizer.php b/src/GraphQl/Serializer/ObjectNormalizer.php index 3bb79682e90..06a10f36c48 100644 --- a/src/GraphQl/Serializer/ObjectNormalizer.php +++ b/src/GraphQl/Serializer/ObjectNormalizer.php @@ -68,7 +68,7 @@ public function hasCacheableSupportsMethod(): bool * * @throws UnexpectedValueException */ - public function normalize($object, $format = null, array $context = []) + public function normalize($object, $format = null, array $context = []): array { if (isset($context['api_resource'])) { $originalResource = $context['api_resource']; diff --git a/src/Symfony/Bundle/Command/DebugResourceCommand.php b/src/Symfony/Bundle/Command/DebugResourceCommand.php index 9c83ff153dd..5b48143eb98 100644 --- a/src/Symfony/Bundle/Command/DebugResourceCommand.php +++ b/src/Symfony/Bundle/Command/DebugResourceCommand.php @@ -50,7 +50,7 @@ protected function configure(): void /** * {@inheritdoc} */ - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $resourceClass = $input->getArgument('class'); diff --git a/tests/Fixtures/TestBundle/Serializer/Denormalizer/DummyPlainIdentifierDenormalizer.php b/tests/Fixtures/TestBundle/Serializer/Denormalizer/DummyPlainIdentifierDenormalizer.php index 17f6ab0980e..42a37f452d4 100644 --- a/tests/Fixtures/TestBundle/Serializer/Denormalizer/DummyPlainIdentifierDenormalizer.php +++ b/tests/Fixtures/TestBundle/Serializer/Denormalizer/DummyPlainIdentifierDenormalizer.php @@ -42,6 +42,8 @@ public function __construct(IriConverterInterface $iriConverter) /** * {@inheritdoc} + * + * @return mixed */ public function denormalize($data, $class, $format = null, array $context = []) { diff --git a/tests/Fixtures/TestBundle/Serializer/Denormalizer/RelatedDummyPlainIdentifierDenormalizer.php b/tests/Fixtures/TestBundle/Serializer/Denormalizer/RelatedDummyPlainIdentifierDenormalizer.php index fcecaf5e2ea..a3fa3bdd5d1 100644 --- a/tests/Fixtures/TestBundle/Serializer/Denormalizer/RelatedDummyPlainIdentifierDenormalizer.php +++ b/tests/Fixtures/TestBundle/Serializer/Denormalizer/RelatedDummyPlainIdentifierDenormalizer.php @@ -45,6 +45,8 @@ public function __construct(IriConverterInterface $iriConverter) /** * {@inheritdoc} + * + * @return mixed */ public function denormalize($data, $class, $format = null, array $context = []) { diff --git a/tests/Fixtures/TestBundle/Serializer/Normalizer/OverrideDocumentationNormalizer.php b/tests/Fixtures/TestBundle/Serializer/Normalizer/OverrideDocumentationNormalizer.php index 1114aea3a6b..7e3d0bb890e 100644 --- a/tests/Fixtures/TestBundle/Serializer/Normalizer/OverrideDocumentationNormalizer.php +++ b/tests/Fixtures/TestBundle/Serializer/Normalizer/OverrideDocumentationNormalizer.php @@ -28,6 +28,13 @@ public function __construct(NormalizerInterface $documentationNormalizer) $this->documentationNormalizer = $documentationNormalizer; } + /** + * @param mixed $object + * @param null $format + * @param array $context + * @return array|\ArrayObject|bool|float|int|string|null + * @throws \Symfony\Component\Serializer\Exception\ExceptionInterface + */ public function normalize($object, $format = null, array $context = []) { $data = $this->documentationNormalizer->normalize($object, $format, $context); From ff6211e6f8a2a3281cce5ee3a0aea8882b8a2bf6 Mon Sep 17 00:00:00 2001 From: "pierre.rebeilleau" Date: Wed, 27 Oct 2021 15:20:25 +0200 Subject: [PATCH 2/2] Fix php-cs-fixer error --- src/Core/Hal/Serializer/ItemNormalizer.php | 1 + src/Core/Hal/Serializer/ObjectNormalizer.php | 1 + .../Normalizer/OverrideDocumentationNormalizer.php | 7 ++++--- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Core/Hal/Serializer/ItemNormalizer.php b/src/Core/Hal/Serializer/ItemNormalizer.php index 3afa9534a8e..8436a1d6cfb 100644 --- a/src/Core/Hal/Serializer/ItemNormalizer.php +++ b/src/Core/Hal/Serializer/ItemNormalizer.php @@ -50,6 +50,7 @@ public function supportsNormalization($data, $format = null): bool /** * {@inheritdoc} + * * @return array|string|int|float|bool|\ArrayObject|null */ public function normalize($object, $format = null, array $context = []) diff --git a/src/Core/Hal/Serializer/ObjectNormalizer.php b/src/Core/Hal/Serializer/ObjectNormalizer.php index c2e623cc60c..9dc5e211f57 100644 --- a/src/Core/Hal/Serializer/ObjectNormalizer.php +++ b/src/Core/Hal/Serializer/ObjectNormalizer.php @@ -60,6 +60,7 @@ public function hasCacheableSupportsMethod(): bool /** * {@inheritdoc} + * * @return array|string|int|float|bool|\ArrayObject|null */ public function normalize($object, $format = null, array $context = []) diff --git a/tests/Fixtures/TestBundle/Serializer/Normalizer/OverrideDocumentationNormalizer.php b/tests/Fixtures/TestBundle/Serializer/Normalizer/OverrideDocumentationNormalizer.php index 7e3d0bb890e..cfa68bcb975 100644 --- a/tests/Fixtures/TestBundle/Serializer/Normalizer/OverrideDocumentationNormalizer.php +++ b/tests/Fixtures/TestBundle/Serializer/Normalizer/OverrideDocumentationNormalizer.php @@ -30,10 +30,11 @@ public function __construct(NormalizerInterface $documentationNormalizer) /** * @param mixed $object - * @param null $format - * @param array $context - * @return array|\ArrayObject|bool|float|int|string|null + * @param null $format + * * @throws \Symfony\Component\Serializer\Exception\ExceptionInterface + * + * @return array|\ArrayObject|bool|float|int|string|null */ public function normalize($object, $format = null, array $context = []) {