Skip to content

Commit

Permalink
chore: remove Symfony 6.3 deprecation messages
Browse files Browse the repository at this point in the history
  • Loading branch information
cyve committed Sep 12, 2023
1 parent f71d21a commit 89bc8dd
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 14 deletions.
3 changes: 2 additions & 1 deletion spec/Tracing/Propagation/Messenger/TraceContextStampSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Instrumentation\Tracing\Propagation\Exception\ContextPropagationException;
use OpenTelemetry\API\Trace\NonRecordingSpan;
use OpenTelemetry\API\Trace\SpanContext;
use OpenTelemetry\API\Trace\TraceFlags;
use OpenTelemetry\API\Trace\TraceState;
use PhpSpec\ObjectBehavior;
use Symfony\Component\Messenger\Stamp\StampInterface;
Expand Down Expand Up @@ -48,7 +49,7 @@ public function it_creates_stamp_with_state(): void
$span = new NonRecordingSpan(SpanContext::create(
'b23f37322b169de7bcaf63b9f84b1427',
'3c17130d40834256',
SpanContext::TRACE_FLAG_DEFAULT,
TraceFlags::DEFAULT,
(new TraceState())->with('key', 'value'),
));
$scope = $span->activate();
Expand Down
2 changes: 1 addition & 1 deletion src/Http/TracingHttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ final class TracingHttpClient implements HttpClientInterface
* @param HttpClientInterface|array<mixed>|null $client
*/
public function __construct(
HttpClientInterface|array|null $client = null,
HttpClientInterface|array $client = null,
ClientRequestOperationNameResolverInterface $operationNameResolver = null,
ClientRequestAttributeProviderInterface $attributeProvider = null,
int $maxHostConnections = 6,
Expand Down
4 changes: 4 additions & 0 deletions src/InstrumentationBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ public function getContainerExtensionClass(): string

public function boot(): void
{
if (null === $this->container) {
return;
}

$this->container->get(Logging\Logging::class);

/** @var TracerProviderInterface $tracerProvider */
Expand Down
2 changes: 1 addition & 1 deletion src/Logging/Logging.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace Instrumentation\Logging;

use OpenTelemetry\API\Common\Log\LoggerHolder;
use OpenTelemetry\API\LoggerHolder;
use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
interface ServerRequestAttributeProviderInterface
{
/**
* @return array<string|TraceAttributes::*,string|array<string>>
* @return array<non-empty-string|TraceAttributes::*,string|array<string>>
*/
public function getAttributes(Request $request): array;
}
4 changes: 2 additions & 2 deletions src/Semantics/OperationName/RoutePath/RouteCacheWarmer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class MessengerEventSubscriber implements EventSubscriberInterface
private LoggerInterface $logger;
private ?ScopeInterface $scope = null;

public function __construct(LoggerInterface|null $logger = null)
public function __construct(LoggerInterface $logger = null)
{
$this->logger = $logger ?? new NullLogger();
}
Expand Down
28 changes: 21 additions & 7 deletions src/Tracing/Serializer/Normalizer/ErrorNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,34 @@

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);
}
}

/**
* @return array<class-string, bool>
*/
public function getSupportedTypes(?string $format): array
{
return [
FlattenException::class => __CLASS__ === self::class,
];
}

/**
* @param array<mixed> $context
*
Expand Down Expand Up @@ -52,9 +71,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();
}
}

0 comments on commit 89bc8dd

Please sign in to comment.