From 5531758c004ed65c035ba5626d764b7a7ad4c048 Mon Sep 17 00:00:00 2001 From: cyve Date: Mon, 11 Sep 2023 23:08:13 +0200 Subject: [PATCH] chore: remove Symfony 6.3 deprecation messages --- .../RoutePath/RouteCacheWarmer.php | 4 +-- .../Serializer/Normalizer/ErrorNormalizer.php | 25 +++++++++++++------ 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/Semantics/OperationName/RoutePath/RouteCacheWarmer.php b/src/Semantics/OperationName/RoutePath/RouteCacheWarmer.php index 31580e5..313d505 100644 --- a/src/Semantics/OperationName/RoutePath/RouteCacheWarmer.php +++ b/src/Semantics/OperationName/RoutePath/RouteCacheWarmer.php @@ -18,12 +18,12 @@ public function __construct(private RouterInterface $router) { } - public function isOptional() + public function isOptional(): bool { return true; } - public function warmUp(string $cacheDir) + public function warmUp(string $cacheDir): array { $routes = []; foreach ($this->router->getRouteCollection() as $name => $route) { diff --git a/src/Tracing/Serializer/Normalizer/ErrorNormalizer.php b/src/Tracing/Serializer/Normalizer/ErrorNormalizer.php index 900cc59..f74a177 100644 --- a/src/Tracing/Serializer/Normalizer/ErrorNormalizer.php +++ b/src/Tracing/Serializer/Normalizer/ErrorNormalizer.php @@ -11,15 +11,31 @@ use Instrumentation\Tracing\TraceUrlGeneratorInterface; use OpenTelemetry\SDK\Trace\Span; -use Symfony\Component\Serializer\Normalizer\CacheableSupportsMethodInterface; +use Symfony\Component\ErrorHandler\Exception\FlattenException; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; +use Symfony\Component\Serializer\SerializerAwareInterface; +use Symfony\Component\Serializer\SerializerInterface; -class ErrorNormalizer implements NormalizerInterface, CacheableSupportsMethodInterface +class ErrorNormalizer implements NormalizerInterface, SerializerAwareInterface { public function __construct(private NormalizerInterface $decorated, private bool $addUrl = false, private ?TraceUrlGeneratorInterface $traceUrlGenerator = null) { } + public function setSerializer(SerializerInterface $serializer) + { + if ($this->decorated instanceof SerializerAwareInterface) { + $this->decorated->setSerializer($serializer); + } + } + + public function getSupportedTypes(?string $format): array + { + return [ + FlattenException::class => __CLASS__ === self::class, + ]; + } + /** * @param array $context * @@ -52,9 +68,4 @@ public function supportsNormalization($data, string $format = null, array $conte // @phpstan-ignore-next-line return $this->decorated->supportsNormalization($data, $format, $context); } - - public function hasCacheableSupportsMethod(): bool - { - return $this->decorated instanceof CacheableSupportsMethodInterface && $this->decorated->hasCacheableSupportsMethod(); - } }