From 60779f2a5a82d8d5f9e5a6c4fb4587a5c27abfa6 Mon Sep 17 00:00:00 2001 From: Michael Hoffmann Date: Mon, 29 Jul 2024 12:49:10 +0200 Subject: [PATCH] Apply code style fixes --- src/Command/SentryTestCommand.php | 2 +- src/DependencyInjection/Compiler/DbalTracingPass.php | 6 +++--- src/ErrorTypesParser.php | 2 +- src/EventListener/AbstractTracingRequestListener.php | 2 +- src/EventListener/TracingRequestListener.php | 4 ++-- src/EventListener/TracingSubRequestListener.php | 2 +- src/Tracing/Cache/TraceableCacheAdapterForV2.php | 2 +- src/Tracing/Cache/TraceableCacheAdapterForV3.php | 2 +- src/Tracing/Cache/TraceableCacheAdapterTrait.php | 2 +- .../Cache/TraceableTagAwareCacheAdapterForV2.php | 2 +- .../Cache/TraceableTagAwareCacheAdapterForV3.php | 2 +- .../Doctrine/DBAL/TracingDriverConnectionForV2V3.php | 6 +++--- .../Doctrine/DBAL/TracingDriverConnectionForV4.php | 4 ++-- .../Doctrine/DBAL/TracingDriverMiddleware.php | 4 ++-- .../DBAL/TracingServerInfoAwareDriverConnection.php | 12 ++++++------ .../HttpClient/AbstractTraceableHttpClient.php | 2 +- src/Tracing/HttpClient/AbstractTraceableResponse.php | 2 +- src/Tracing/Twig/TwigTracingExtension.php | 2 +- src/Twig/SentryExtension.php | 6 +++--- .../Cache/AbstractTraceableCacheAdapterTest.php | 4 ++-- tests/Tracing/HttpClient/TraceableResponseTest.php | 2 +- 21 files changed, 36 insertions(+), 36 deletions(-) diff --git a/src/Command/SentryTestCommand.php b/src/Command/SentryTestCommand.php index 94ed9454..5c28a46e 100644 --- a/src/Command/SentryTestCommand.php +++ b/src/Command/SentryTestCommand.php @@ -25,7 +25,7 @@ public function __construct(?HubInterface $hub = null) parent::__construct(); if (null === $hub) { - @trigger_error(sprintf('Not passing an instance of the "%s" interface as argument of the constructor is deprecated since version 4.12 and will not work since version 5.0.', HubInterface::class), \E_USER_DEPRECATED); + @trigger_error(\sprintf('Not passing an instance of the "%s" interface as argument of the constructor is deprecated since version 4.12 and will not work since version 5.0.', HubInterface::class), \E_USER_DEPRECATED); } $this->hub = $hub ?? SentrySdk::getCurrentHub(); diff --git a/src/DependencyInjection/Compiler/DbalTracingPass.php b/src/DependencyInjection/Compiler/DbalTracingPass.php index e867a781..e4cbcdd7 100644 --- a/src/DependencyInjection/Compiler/DbalTracingPass.php +++ b/src/DependencyInjection/Compiler/DbalTracingPass.php @@ -45,8 +45,8 @@ public function process(ContainerBuilder $container): void } foreach ($connectionsToTrace as $connectionName) { - if (!\in_array(sprintf(self::CONNECTION_SERVICE_NAME_FORMAT, $connectionName), $connections, true)) { - throw new \InvalidArgumentException(sprintf('The Doctrine connection "%s" does not exists and cannot be instrumented.', $connectionName)); + if (!\in_array(\sprintf(self::CONNECTION_SERVICE_NAME_FORMAT, $connectionName), $connections, true)) { + throw new \InvalidArgumentException(\sprintf('The Doctrine connection "%s" does not exists and cannot be instrumented.', $connectionName)); } if (class_exists(Result::class)) { @@ -65,7 +65,7 @@ private function configureConnectionForDoctrineDBALVersion3(ContainerBuilder $co private function configureConnectionForDoctrineDBALVersion2(ContainerBuilder $container, string $connectionName): void { - $connectionDefinition = $container->getDefinition(sprintf(self::CONNECTION_SERVICE_NAME_FORMAT, $connectionName)); + $connectionDefinition = $container->getDefinition(\sprintf(self::CONNECTION_SERVICE_NAME_FORMAT, $connectionName)); $connectionDefinition->setConfigurator([new Reference(ConnectionConfigurator::class), 'configure']); } diff --git a/src/ErrorTypesParser.php b/src/ErrorTypesParser.php index ce0d7b90..b717c641 100644 --- a/src/ErrorTypesParser.php +++ b/src/ErrorTypesParser.php @@ -75,7 +75,7 @@ private static function convertErrorConstants(string $value): string }, $value); if (null === $output) { - throw new \InvalidArgumentException(sprintf('The "%s" value could not be parsed.', $value)); + throw new \InvalidArgumentException(\sprintf('The "%s" value could not be parsed.', $value)); } return $output; diff --git a/src/EventListener/AbstractTracingRequestListener.php b/src/EventListener/AbstractTracingRequestListener.php index 022f2d1b..95c31543 100644 --- a/src/EventListener/AbstractTracingRequestListener.php +++ b/src/EventListener/AbstractTracingRequestListener.php @@ -67,7 +67,7 @@ protected function getRouteName(Request $request): string $route = $request->attributes->get('_controller'); if (\is_array($route) && \is_callable($route, true)) { - $route = sprintf('%s::%s', \is_object($route[0]) ? get_debug_type($route[0]) : $route[0], $route[1]); + $route = \sprintf('%s::%s', \is_object($route[0]) ? get_debug_type($route[0]) : $route[0], $route[1]); } } diff --git a/src/EventListener/TracingRequestListener.php b/src/EventListener/TracingRequestListener.php index f5667953..10f8a2bf 100644 --- a/src/EventListener/TracingRequestListener.php +++ b/src/EventListener/TracingRequestListener.php @@ -46,10 +46,10 @@ public function handleKernelRequestEvent(RequestEvent $event): void $routeName = $request->attributes->get('_route'); if (null !== $routeName && \is_string($routeName)) { - $context->setName(sprintf('%s %s', $request->getMethod(), $routeName)); + $context->setName(\sprintf('%s %s', $request->getMethod(), $routeName)); $context->setSource(TransactionSource::route()); } else { - $context->setName(sprintf('%s %s%s%s', $request->getMethod(), $request->getSchemeAndHttpHost(), $request->getBaseUrl(), $request->getPathInfo())); + $context->setName(\sprintf('%s %s%s%s', $request->getMethod(), $request->getSchemeAndHttpHost(), $request->getBaseUrl(), $request->getPathInfo())); $context->setSource(TransactionSource::url()); } diff --git a/src/EventListener/TracingSubRequestListener.php b/src/EventListener/TracingSubRequestListener.php index 6791d548..12b0d7b0 100644 --- a/src/EventListener/TracingSubRequestListener.php +++ b/src/EventListener/TracingSubRequestListener.php @@ -36,7 +36,7 @@ public function handleKernelRequestEvent(RequestEvent $event): void $spanContext = new SpanContext(); $spanContext->setOp('http.server'); - $spanContext->setDescription(sprintf('%s %s%s%s', $request->getMethod(), $request->getSchemeAndHttpHost(), $request->getBaseUrl(), $request->getPathInfo())); + $spanContext->setDescription(\sprintf('%s %s%s%s', $request->getMethod(), $request->getSchemeAndHttpHost(), $request->getBaseUrl(), $request->getPathInfo())); $spanContext->setData([ 'http.request.method' => $request->getMethod(), 'http.url' => $request->getUri(), diff --git a/src/Tracing/Cache/TraceableCacheAdapterForV2.php b/src/Tracing/Cache/TraceableCacheAdapterForV2.php index 7a5b57c9..ab8a6e86 100644 --- a/src/Tracing/Cache/TraceableCacheAdapterForV2.php +++ b/src/Tracing/Cache/TraceableCacheAdapterForV2.php @@ -44,7 +44,7 @@ public function get(string $key, callable $callback, float $beta = null, array & { return $this->traceFunction('cache.get_item', function () use ($key, $callback, $beta, &$metadata) { if (!$this->decoratedAdapter instanceof CacheInterface) { - throw new \BadMethodCallException(sprintf('The %s::get() method is not supported because the decorated adapter does not implement the "%s" interface.', self::class, CacheInterface::class)); + throw new \BadMethodCallException(\sprintf('The %s::get() method is not supported because the decorated adapter does not implement the "%s" interface.', self::class, CacheInterface::class)); } return $this->decoratedAdapter->get($key, $callback, $beta, $metadata); diff --git a/src/Tracing/Cache/TraceableCacheAdapterForV3.php b/src/Tracing/Cache/TraceableCacheAdapterForV3.php index 564acff3..cd9e205c 100644 --- a/src/Tracing/Cache/TraceableCacheAdapterForV3.php +++ b/src/Tracing/Cache/TraceableCacheAdapterForV3.php @@ -42,7 +42,7 @@ public function get(string $key, callable $callback, float $beta = null, array & { return $this->traceFunction('cache.get_item', function () use ($key, $callback, $beta, &$metadata) { if (!$this->decoratedAdapter instanceof CacheInterface) { - throw new \BadMethodCallException(sprintf('The %s::get() method is not supported because the decorated adapter does not implement the "%s" interface.', self::class, CacheInterface::class)); + throw new \BadMethodCallException(\sprintf('The %s::get() method is not supported because the decorated adapter does not implement the "%s" interface.', self::class, CacheInterface::class)); } return $this->decoratedAdapter->get($key, $callback, $beta, $metadata); diff --git a/src/Tracing/Cache/TraceableCacheAdapterTrait.php b/src/Tracing/Cache/TraceableCacheAdapterTrait.php index a479c0b9..9bb267a3 100644 --- a/src/Tracing/Cache/TraceableCacheAdapterTrait.php +++ b/src/Tracing/Cache/TraceableCacheAdapterTrait.php @@ -70,7 +70,7 @@ public function delete(string $key): bool { return $this->traceFunction('cache.delete_item', function () use ($key): bool { if (!$this->decoratedAdapter instanceof CacheInterface) { - throw new \BadMethodCallException(sprintf('The %s::delete() method is not supported because the decorated adapter does not implement the "%s" interface.', self::class, CacheInterface::class)); + throw new \BadMethodCallException(\sprintf('The %s::delete() method is not supported because the decorated adapter does not implement the "%s" interface.', self::class, CacheInterface::class)); } return $this->decoratedAdapter->delete($key); diff --git a/src/Tracing/Cache/TraceableTagAwareCacheAdapterForV2.php b/src/Tracing/Cache/TraceableTagAwareCacheAdapterForV2.php index a89d911f..e3a807f8 100644 --- a/src/Tracing/Cache/TraceableTagAwareCacheAdapterForV2.php +++ b/src/Tracing/Cache/TraceableTagAwareCacheAdapterForV2.php @@ -45,7 +45,7 @@ public function get(string $key, callable $callback, float $beta = null, array & { return $this->traceFunction('cache.get_item', function () use ($key, $callback, $beta, &$metadata) { if (!$this->decoratedAdapter instanceof CacheInterface) { - throw new \BadMethodCallException(sprintf('The %s::get() method is not supported because the decorated adapter does not implement the "%s" interface.', self::class, CacheInterface::class)); + throw new \BadMethodCallException(\sprintf('The %s::get() method is not supported because the decorated adapter does not implement the "%s" interface.', self::class, CacheInterface::class)); } return $this->decoratedAdapter->get($key, $callback, $beta, $metadata); diff --git a/src/Tracing/Cache/TraceableTagAwareCacheAdapterForV3.php b/src/Tracing/Cache/TraceableTagAwareCacheAdapterForV3.php index 733b4555..700df5e7 100644 --- a/src/Tracing/Cache/TraceableTagAwareCacheAdapterForV3.php +++ b/src/Tracing/Cache/TraceableTagAwareCacheAdapterForV3.php @@ -43,7 +43,7 @@ public function get(string $key, callable $callback, float $beta = null, array & { return $this->traceFunction('cache.get_item', function () use ($key, $callback, $beta, &$metadata) { if (!$this->decoratedAdapter instanceof CacheInterface) { - throw new \BadMethodCallException(sprintf('The %s::get() method is not supported because the decorated adapter does not implement the "%s" interface.', self::class, CacheInterface::class)); + throw new \BadMethodCallException(\sprintf('The %s::get() method is not supported because the decorated adapter does not implement the "%s" interface.', self::class, CacheInterface::class)); } return $this->decoratedAdapter->get($key, $callback, $beta, $metadata); diff --git a/src/Tracing/Doctrine/DBAL/TracingDriverConnectionForV2V3.php b/src/Tracing/Doctrine/DBAL/TracingDriverConnectionForV2V3.php index 6e79102e..22c8d6d0 100644 --- a/src/Tracing/Doctrine/DBAL/TracingDriverConnectionForV2V3.php +++ b/src/Tracing/Doctrine/DBAL/TracingDriverConnectionForV2V3.php @@ -176,7 +176,7 @@ public function rollBack(): bool public function getNativeConnection() { if (!method_exists($this->decoratedConnection, 'getNativeConnection')) { - throw new \BadMethodCallException(sprintf('The connection "%s" does not support accessing the native connection.', \get_class($this->decoratedConnection))); + throw new \BadMethodCallException(\sprintf('The connection "%s" does not support accessing the native connection.', \get_class($this->decoratedConnection))); } return $this->decoratedConnection->getNativeConnection(); @@ -191,7 +191,7 @@ public function errorCode(): ?string return $this->decoratedConnection->errorCode(); } - throw new \BadMethodCallException(sprintf('The %s() method is not supported on Doctrine DBAL 3.0.', __METHOD__)); + throw new \BadMethodCallException(\sprintf('The %s() method is not supported on Doctrine DBAL 3.0.', __METHOD__)); } /** @@ -203,7 +203,7 @@ public function errorInfo(): array return $this->decoratedConnection->errorInfo(); } - throw new \BadMethodCallException(sprintf('The %s() method is not supported on Doctrine DBAL 3.0.', __METHOD__)); + throw new \BadMethodCallException(\sprintf('The %s() method is not supported on Doctrine DBAL 3.0.', __METHOD__)); } public function getWrappedConnection(): DriverConnectionInterface diff --git a/src/Tracing/Doctrine/DBAL/TracingDriverConnectionForV4.php b/src/Tracing/Doctrine/DBAL/TracingDriverConnectionForV4.php index 88ae34b3..0087fd89 100644 --- a/src/Tracing/Doctrine/DBAL/TracingDriverConnectionForV4.php +++ b/src/Tracing/Doctrine/DBAL/TracingDriverConnectionForV4.php @@ -184,7 +184,7 @@ public function errorCode(): ?string return $this->decoratedConnection->errorCode(); } - throw new \BadMethodCallException(sprintf('The %s() method is not supported on Doctrine DBAL 3.0.', __METHOD__)); + throw new \BadMethodCallException(\sprintf('The %s() method is not supported on Doctrine DBAL 3.0.', __METHOD__)); } /** @@ -196,7 +196,7 @@ public function errorInfo(): array return $this->decoratedConnection->errorInfo(); } - throw new \BadMethodCallException(sprintf('The %s() method is not supported on Doctrine DBAL 3.0.', __METHOD__)); + throw new \BadMethodCallException(\sprintf('The %s() method is not supported on Doctrine DBAL 3.0.', __METHOD__)); } public function getWrappedConnection(): DriverConnectionInterface diff --git a/src/Tracing/Doctrine/DBAL/TracingDriverMiddleware.php b/src/Tracing/Doctrine/DBAL/TracingDriverMiddleware.php index 0ef93b70..d9129441 100644 --- a/src/Tracing/Doctrine/DBAL/TracingDriverMiddleware.php +++ b/src/Tracing/Doctrine/DBAL/TracingDriverMiddleware.php @@ -31,11 +31,11 @@ public function __construct($hubOrConnectionFactory) if ($hubOrConnectionFactory instanceof TracingDriverConnectionFactoryInterface) { $this->connectionFactory = $hubOrConnectionFactory; } elseif ($hubOrConnectionFactory instanceof HubInterface) { - @trigger_error(sprintf('Not passing an instance of the "%s" interface as argument of the constructor is deprecated since version 4.2 and will not work since version 5.0.', TracingDriverConnectionFactoryInterface::class), \E_USER_DEPRECATED); + @trigger_error(\sprintf('Not passing an instance of the "%s" interface as argument of the constructor is deprecated since version 4.2 and will not work since version 5.0.', TracingDriverConnectionFactoryInterface::class), \E_USER_DEPRECATED); $this->connectionFactory = new TracingDriverConnectionFactory($hubOrConnectionFactory); } else { - throw new \InvalidArgumentException(sprintf('The constructor requires either an instance of the "%s" interface or an instance of the "%s" interface.', HubInterface::class, TracingDriverConnectionFactoryInterface::class)); + throw new \InvalidArgumentException(\sprintf('The constructor requires either an instance of the "%s" interface or an instance of the "%s" interface.', HubInterface::class, TracingDriverConnectionFactoryInterface::class)); } } diff --git a/src/Tracing/Doctrine/DBAL/TracingServerInfoAwareDriverConnection.php b/src/Tracing/Doctrine/DBAL/TracingServerInfoAwareDriverConnection.php index de1270bd..30945e97 100644 --- a/src/Tracing/Doctrine/DBAL/TracingServerInfoAwareDriverConnection.php +++ b/src/Tracing/Doctrine/DBAL/TracingServerInfoAwareDriverConnection.php @@ -109,7 +109,7 @@ public function getServerVersion(): string $wrappedConnection = $this->getWrappedConnection(); if (!$wrappedConnection instanceof ServerInfoAwareConnection) { - throw new \BadMethodCallException(sprintf('The wrapped connection must be an instance of the "%s" interface.', ServerInfoAwareConnection::class)); + throw new \BadMethodCallException(\sprintf('The wrapped connection must be an instance of the "%s" interface.', ServerInfoAwareConnection::class)); } return $wrappedConnection->getServerVersion(); @@ -123,7 +123,7 @@ public function getServerVersion(): string public function getNativeConnection() { if (!method_exists($this->decoratedConnection, 'getNativeConnection')) { - throw new \BadMethodCallException(sprintf('The connection "%s" does not support accessing the native connection.', \get_class($this->decoratedConnection))); + throw new \BadMethodCallException(\sprintf('The connection "%s" does not support accessing the native connection.', \get_class($this->decoratedConnection))); } return $this->decoratedConnection->getNativeConnection(); @@ -137,11 +137,11 @@ public function requiresQueryForServerVersion(): bool $wrappedConnection = $this->getWrappedConnection(); if (!$wrappedConnection instanceof ServerInfoAwareConnection) { - throw new \BadMethodCallException(sprintf('The wrapped connection must be an instance of the "%s" interface.', ServerInfoAwareConnection::class)); + throw new \BadMethodCallException(\sprintf('The wrapped connection must be an instance of the "%s" interface.', ServerInfoAwareConnection::class)); } if (!method_exists($wrappedConnection, 'requiresQueryForServerVersion')) { - throw new \BadMethodCallException(sprintf('The %s() method is not supported on Doctrine DBAL 3.0.', __METHOD__)); + throw new \BadMethodCallException(\sprintf('The %s() method is not supported on Doctrine DBAL 3.0.', __METHOD__)); } return $wrappedConnection->requiresQueryForServerVersion(); @@ -156,7 +156,7 @@ public function errorCode(): ?string return $this->decoratedConnection->errorCode(); } - throw new \BadMethodCallException(sprintf('The %s() method is not supported on Doctrine DBAL 3.0.', __METHOD__)); + throw new \BadMethodCallException(\sprintf('The %s() method is not supported on Doctrine DBAL 3.0.', __METHOD__)); } /** @@ -168,7 +168,7 @@ public function errorInfo(): array return $this->decoratedConnection->errorInfo(); } - throw new \BadMethodCallException(sprintf('The %s() method is not supported on Doctrine DBAL 3.0.', __METHOD__)); + throw new \BadMethodCallException(\sprintf('The %s() method is not supported on Doctrine DBAL 3.0.', __METHOD__)); } public function getWrappedConnection(): Connection diff --git a/src/Tracing/HttpClient/AbstractTraceableHttpClient.php b/src/Tracing/HttpClient/AbstractTraceableHttpClient.php index 1220600f..275774d6 100644 --- a/src/Tracing/HttpClient/AbstractTraceableHttpClient.php +++ b/src/Tracing/HttpClient/AbstractTraceableHttpClient.php @@ -111,7 +111,7 @@ public function stream($responses, float $timeout = null): ResponseStreamInterfa if ($responses instanceof AbstractTraceableResponse) { $responses = [$responses]; } elseif (!is_iterable($responses)) { - throw new \TypeError(sprintf('"%s()" expects parameter 1 to be an iterable of TraceableResponse objects, "%s" given.', __METHOD__, get_debug_type($responses))); + throw new \TypeError(\sprintf('"%s()" expects parameter 1 to be an iterable of TraceableResponse objects, "%s" given.', __METHOD__, get_debug_type($responses))); } return new ResponseStream(AbstractTraceableResponse::stream($this->client, $responses, $timeout)); diff --git a/src/Tracing/HttpClient/AbstractTraceableResponse.php b/src/Tracing/HttpClient/AbstractTraceableResponse.php index f53ecd8d..aba53b8e 100644 --- a/src/Tracing/HttpClient/AbstractTraceableResponse.php +++ b/src/Tracing/HttpClient/AbstractTraceableResponse.php @@ -107,7 +107,7 @@ public static function stream(HttpClientInterface $client, iterable $responses, foreach ($responses as $response) { if (!$response instanceof self) { - throw new \TypeError(sprintf('"%s::stream()" expects parameter 1 to be an iterable of TraceableResponse objects, "%s" given.', TraceableHttpClient::class, get_debug_type($response))); + throw new \TypeError(\sprintf('"%s::stream()" expects parameter 1 to be an iterable of TraceableResponse objects, "%s" given.', TraceableHttpClient::class, get_debug_type($response))); } $traceableMap[$response->response] = $response; diff --git a/src/Tracing/Twig/TwigTracingExtension.php b/src/Tracing/Twig/TwigTracingExtension.php index ec06e58c..94504846 100644 --- a/src/Tracing/Twig/TwigTracingExtension.php +++ b/src/Tracing/Twig/TwigTracingExtension.php @@ -95,7 +95,7 @@ private function getSpanDescription(Profile $profile): string return $profile->getTemplate(); default: - return sprintf('%s::%s(%s)', $profile->getTemplate(), $profile->getType(), $profile->getName()); + return \sprintf('%s::%s(%s)', $profile->getTemplate(), $profile->getType(), $profile->getName()); } } } diff --git a/src/Twig/SentryExtension.php b/src/Twig/SentryExtension.php index 2e4f31ed..d6a93984 100644 --- a/src/Twig/SentryExtension.php +++ b/src/Twig/SentryExtension.php @@ -38,7 +38,7 @@ public function getFunctions(): array */ public function getTraceMeta(): string { - return sprintf('', getTraceparent()); + return \sprintf('', getTraceparent()); } /** @@ -46,7 +46,7 @@ public function getTraceMeta(): string */ public function getW3CTraceMeta(): string { - return sprintf('', getW3CTraceparent()); + return \sprintf('', getW3CTraceparent()); } /** @@ -54,6 +54,6 @@ public function getW3CTraceMeta(): string */ public function getBaggageMeta(): string { - return sprintf('', getBaggage()); + return \sprintf('', getBaggage()); } } diff --git a/tests/Tracing/Cache/AbstractTraceableCacheAdapterTest.php b/tests/Tracing/Cache/AbstractTraceableCacheAdapterTest.php index 75583c8b..4b49194f 100644 --- a/tests/Tracing/Cache/AbstractTraceableCacheAdapterTest.php +++ b/tests/Tracing/Cache/AbstractTraceableCacheAdapterTest.php @@ -159,7 +159,7 @@ public function testGetThrowsExceptionIfDecoratedAdapterDoesNotImplementTheCache $adapter = $this->createCacheAdapter($this->createMock(static::getAdapterClassFqcn())); $this->expectException(\BadMethodCallException::class); - $this->expectExceptionMessage(sprintf('The %s::get() method is not supported because the decorated adapter does not implement the "Symfony\\Contracts\\Cache\\CacheInterface" interface.', \get_class($adapter))); + $this->expectExceptionMessage(\sprintf('The %s::get() method is not supported because the decorated adapter does not implement the "Symfony\\Contracts\\Cache\\CacheInterface" interface.', \get_class($adapter))); $adapter->get('foo', static function () {}); } @@ -197,7 +197,7 @@ public function testDeleteThrowsExceptionIfDecoratedAdapterDoesNotImplementTheCa $adapter = $this->createCacheAdapter($this->createMock(static::getAdapterClassFqcn())); $this->expectException(\BadMethodCallException::class); - $this->expectExceptionMessage(sprintf('The %s::delete() method is not supported because the decorated adapter does not implement the "Symfony\\Contracts\\Cache\\CacheInterface" interface.', \get_class($adapter))); + $this->expectExceptionMessage(\sprintf('The %s::delete() method is not supported because the decorated adapter does not implement the "Symfony\\Contracts\\Cache\\CacheInterface" interface.', \get_class($adapter))); $adapter->delete('foo'); } diff --git a/tests/Tracing/HttpClient/TraceableResponseTest.php b/tests/Tracing/HttpClient/TraceableResponseTest.php index f8851137..5a4bb370 100644 --- a/tests/Tracing/HttpClient/TraceableResponseTest.php +++ b/tests/Tracing/HttpClient/TraceableResponseTest.php @@ -55,7 +55,7 @@ public function testInstanceCannotBeUnserialized(): void $this->expectException(\BadMethodCallException::class); $this->expectExceptionMessage('Unserializing instances of this class is forbidden.'); - unserialize(sprintf('O:%u:"%s":0:{}', \strlen(TraceableResponse::class), TraceableResponse::class)); + unserialize(\sprintf('O:%u:"%s":0:{}', \strlen(TraceableResponse::class), TraceableResponse::class)); } public function testDestructor(): void