diff --git a/composer.json b/composer.json index 5592e2c5..1af2a500 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ ], "require": { "php": "^7.4 || ^8.0", - "symfony/serializer": "^5.0", + "symfony/serializer": "^5.0 || ^6.0", "elasticsearch/elasticsearch": "^7.0" }, "require-dev": { diff --git a/src/SearchEndpoint/AggregationsEndpoint.php b/src/SearchEndpoint/AggregationsEndpoint.php index 3e035f43..a50a515b 100644 --- a/src/SearchEndpoint/AggregationsEndpoint.php +++ b/src/SearchEndpoint/AggregationsEndpoint.php @@ -27,7 +27,7 @@ class AggregationsEndpoint extends AbstractSearchEndpoint /** * {@inheritdoc} */ - public function normalize(NormalizerInterface $normalizer, string $format = null, array $context = []) + public function normalize(NormalizerInterface $normalizer, string $format = null, array $context = []): array|string|int|float|bool { $output = []; if (count($this->getAll()) > 0) { diff --git a/src/SearchEndpoint/HighlightEndpoint.php b/src/SearchEndpoint/HighlightEndpoint.php index aa57b3d7..0549994e 100644 --- a/src/SearchEndpoint/HighlightEndpoint.php +++ b/src/SearchEndpoint/HighlightEndpoint.php @@ -37,13 +37,13 @@ class HighlightEndpoint extends AbstractSearchEndpoint /** * {@inheritdoc} */ - public function normalize(NormalizerInterface $normalizer, string $format = null, array $context = []) + public function normalize(NormalizerInterface $normalizer, string $format = null, array $context = []): array|string|int|float|bool { if ($this->highlight) { return $this->highlight->toArray(); } - return null; + return false; } /** diff --git a/src/SearchEndpoint/InnerHitsEndpoint.php b/src/SearchEndpoint/InnerHitsEndpoint.php index 8428bd88..58e782b2 100644 --- a/src/SearchEndpoint/InnerHitsEndpoint.php +++ b/src/SearchEndpoint/InnerHitsEndpoint.php @@ -27,7 +27,7 @@ class InnerHitsEndpoint extends AbstractSearchEndpoint /** * {@inheritdoc} */ - public function normalize(NormalizerInterface $normalizer, string $format = null, array $context = []) + public function normalize(NormalizerInterface $normalizer, string $format = null, array $context = []): array|string|int|float|bool { $output = []; if (count($this->getAll()) > 0) { diff --git a/src/SearchEndpoint/PostFilterEndpoint.php b/src/SearchEndpoint/PostFilterEndpoint.php index de3e263c..d0e9a09f 100644 --- a/src/SearchEndpoint/PostFilterEndpoint.php +++ b/src/SearchEndpoint/PostFilterEndpoint.php @@ -26,10 +26,10 @@ class PostFilterEndpoint extends QueryEndpoint /** * {@inheritdoc} */ - public function normalize(NormalizerInterface $normalizer, string $format = null, array $context = []) + public function normalize(NormalizerInterface $normalizer, string $format = null, array $context = []): array|string|int|float|bool { if (!$this->getBool()) { - return null; + return false; } return $this->getBool()->toArray(); diff --git a/src/SearchEndpoint/QueryEndpoint.php b/src/SearchEndpoint/QueryEndpoint.php index b7626910..17d96c0c 100644 --- a/src/SearchEndpoint/QueryEndpoint.php +++ b/src/SearchEndpoint/QueryEndpoint.php @@ -39,7 +39,7 @@ class QueryEndpoint extends AbstractSearchEndpoint implements OrderedNormalizerI /** * {@inheritdoc} */ - public function normalize(NormalizerInterface $normalizer, string $format = null, array $context = []) + public function normalize(NormalizerInterface $normalizer, string $format = null, array $context = []): array|string|int|float|bool { if (!$this->filtersSet && $this->hasReference('filter_query')) { /** @var BuilderInterface $filter */ @@ -49,7 +49,7 @@ public function normalize(NormalizerInterface $normalizer, string $format = null } if (!$this->bool) { - return null; + return false; } return $this->bool->toArray(); diff --git a/src/SearchEndpoint/SortEndpoint.php b/src/SearchEndpoint/SortEndpoint.php index cd00bb2f..009de9d8 100644 --- a/src/SearchEndpoint/SortEndpoint.php +++ b/src/SearchEndpoint/SortEndpoint.php @@ -26,7 +26,7 @@ class SortEndpoint extends AbstractSearchEndpoint /** * {@inheritdoc} */ - public function normalize(NormalizerInterface $normalizer, string $format = null, array $context = []) + public function normalize(NormalizerInterface $normalizer, string $format = null, array $context = []): array|string|int|float|bool { $output = []; diff --git a/src/SearchEndpoint/SuggestEndpoint.php b/src/SearchEndpoint/SuggestEndpoint.php index 6d292239..733b3efc 100644 --- a/src/SearchEndpoint/SuggestEndpoint.php +++ b/src/SearchEndpoint/SuggestEndpoint.php @@ -27,7 +27,7 @@ class SuggestEndpoint extends AbstractSearchEndpoint /** * {@inheritdoc} */ - public function normalize(NormalizerInterface $normalizer, string $format = null, array $context = []) + public function normalize(NormalizerInterface $normalizer, string $format = null, array $context = []): array|string|int|float|bool { $output = []; if (count($this->getAll()) > 0) { diff --git a/src/Serializer/Normalizer/CustomReferencedNormalizer.php b/src/Serializer/Normalizer/CustomReferencedNormalizer.php index fd32a89b..d7a6bd9b 100644 --- a/src/Serializer/Normalizer/CustomReferencedNormalizer.php +++ b/src/Serializer/Normalizer/CustomReferencedNormalizer.php @@ -26,7 +26,7 @@ class CustomReferencedNormalizer extends CustomNormalizer /** * {@inheritdoc} */ - public function normalize($object, string $format = null, array $context = []) + public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { $object->setReferences($this->references); $data = parent::normalize($object, $format, $context); @@ -38,7 +38,7 @@ public function normalize($object, string $format = null, array $context = []) /** * {@inheritdoc} */ - public function supportsNormalization($data, $format = null) + public function supportsNormalization(mixed $data, string $format = null): bool { return $data instanceof AbstractNormalizable; } diff --git a/src/Serializer/OrderedSerializer.php b/src/Serializer/OrderedSerializer.php index 9019e43e..7179069f 100644 --- a/src/Serializer/OrderedSerializer.php +++ b/src/Serializer/OrderedSerializer.php @@ -22,7 +22,7 @@ class OrderedSerializer extends Serializer /** * {@inheritdoc} */ - public function normalize($data, $format = null, array $context = []) + public function normalize(mixed $data, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { return parent::normalize( is_array($data) ? $this->order($data) : $data, @@ -34,7 +34,7 @@ public function normalize($data, $format = null, array $context = []) /** * {@inheritdoc} */ - public function denormalize($data, $type, $format = null, array $context = []) + public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed { return parent::denormalize( is_array($data) ? $this->order($data) : $data, @@ -86,3 +86,4 @@ function ($value) { ); } } +