From b1b8b175713777a9086611901f0fd1e8ab6a1abf Mon Sep 17 00:00:00 2001 From: Michi Hoffmann Date: Tue, 22 Nov 2022 11:57:28 +0100 Subject: [PATCH] style: Update CS (#678) --- phpstan-baseline.neon | 10 +++++----- src/DependencyInjection/SentryExtension.php | 9 ++++----- src/Tracing/Twig/TwigTracingExtension.php | 5 ++--- tests/EventListener/TracingConsoleListenerTest.php | 9 ++++----- 4 files changed, 15 insertions(+), 18 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 9e7d25eb..4dcdcbf9 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -230,6 +230,11 @@ parameters: count: 1 path: src/Tracing/Doctrine/DBAL/TracingStatementForV3.php + - + message: "#^Parameter \\#4 \\$length of method Doctrine\\\\DBAL\\\\Driver\\\\Statement\\:\\:bindParam\\(\\) expects int\\|null, mixed given\\.$#" + count: 1 + path: src/Tracing/Doctrine/DBAL/TracingStatementForV3.php + - message: "#^Method Sentry\\\\SentryBundle\\\\Tracing\\\\HttpClient\\\\AbstractTraceableHttpClient\\:\\:request\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#" count: 1 @@ -245,11 +250,6 @@ parameters: count: 1 path: src/Tracing/HttpClient/TraceableHttpClientForV6.php - - - message: "#^Call to an undefined method Symfony\\\\Contracts\\\\HttpClient\\\\ResponseInterface\\:\\:toStream\\(\\)\\.$#" - count: 1 - path: src/Tracing/HttpClient/TraceableResponseForV5.php - - message: "#^Call to an undefined method Symfony\\\\Contracts\\\\HttpClient\\\\ResponseInterface\\:\\:toStream\\(\\)\\.$#" count: 1 diff --git a/src/DependencyInjection/SentryExtension.php b/src/DependencyInjection/SentryExtension.php index 110b855b..f87458bc 100644 --- a/src/DependencyInjection/SentryExtension.php +++ b/src/DependencyInjection/SentryExtension.php @@ -5,7 +5,6 @@ namespace Sentry\SentryBundle\DependencyInjection; use Doctrine\Bundle\DoctrineBundle\DoctrineBundle; -use LogicException; use Psr\Log\NullLogger; use Sentry\Client; use Sentry\ClientBuilder; @@ -204,7 +203,7 @@ private function registerDbalTracingConfiguration(ContainerBuilder $container, a && $this->isConfigEnabled($container, $config['dbal']); if ($isConfigEnabled && !class_exists(DoctrineBundle::class)) { - throw new LogicException('DBAL tracing support cannot be enabled because the doctrine/doctrine-bundle Composer package is not installed.'); + throw new \LogicException('DBAL tracing support cannot be enabled because the doctrine/doctrine-bundle Composer package is not installed.'); } $container->setParameter('sentry.tracing.dbal.enabled', $isConfigEnabled); @@ -225,7 +224,7 @@ private function registerTwigTracingConfiguration(ContainerBuilder $container, a && $this->isConfigEnabled($container, $config['twig']); if ($isConfigEnabled && !class_exists(TwigBundle::class)) { - throw new LogicException('Twig tracing support cannot be enabled because the symfony/twig-bundle Composer package is not installed.'); + throw new \LogicException('Twig tracing support cannot be enabled because the symfony/twig-bundle Composer package is not installed.'); } if (!$isConfigEnabled) { @@ -242,7 +241,7 @@ private function registerCacheTracingConfiguration(ContainerBuilder $container, && $this->isConfigEnabled($container, $config['cache']); if ($isConfigEnabled && !class_exists(CacheItem::class)) { - throw new LogicException('Cache tracing support cannot be enabled because the symfony/cache Composer package is not installed.'); + throw new \LogicException('Cache tracing support cannot be enabled because the symfony/cache Composer package is not installed.'); } $container->setParameter('sentry.tracing.cache.enabled', $isConfigEnabled); @@ -257,7 +256,7 @@ private function registerHttpClientTracingConfiguration(ContainerBuilder $contai && $this->isConfigEnabled($container, $config['http_client']); if ($isConfigEnabled && !class_exists(HttpClient::class)) { - throw new LogicException('Http client tracing support cannot be enabled because the symfony/http-client Composer package is not installed.'); + throw new \LogicException('Http client tracing support cannot be enabled because the symfony/http-client Composer package is not installed.'); } $container->setParameter('sentry.tracing.http_client.enabled', $isConfigEnabled); diff --git a/src/Tracing/Twig/TwigTracingExtension.php b/src/Tracing/Twig/TwigTracingExtension.php index dda1ce1c..ec06e58c 100644 --- a/src/Tracing/Twig/TwigTracingExtension.php +++ b/src/Tracing/Twig/TwigTracingExtension.php @@ -7,7 +7,6 @@ use Sentry\State\HubInterface; use Sentry\Tracing\Span; use Sentry\Tracing\SpanContext; -use SplObjectStorage; use Twig\Extension\AbstractExtension; use Twig\Profiler\NodeVisitor\ProfilerNodeVisitor; use Twig\Profiler\Profile; @@ -20,7 +19,7 @@ final class TwigTracingExtension extends AbstractExtension private $hub; /** - * @var SplObjectStorage The currently active spans + * @var \SplObjectStorage The currently active spans */ private $spans; @@ -30,7 +29,7 @@ final class TwigTracingExtension extends AbstractExtension public function __construct(HubInterface $hub) { $this->hub = $hub; - $this->spans = new SplObjectStorage(); + $this->spans = new \SplObjectStorage(); } /** diff --git a/tests/EventListener/TracingConsoleListenerTest.php b/tests/EventListener/TracingConsoleListenerTest.php index 313200af..3987ea04 100644 --- a/tests/EventListener/TracingConsoleListenerTest.php +++ b/tests/EventListener/TracingConsoleListenerTest.php @@ -4,7 +4,6 @@ namespace Sentry\SentryBundle\Tests\EventListener; -use Generator; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Sentry\SentryBundle\EventListener\TracingConsoleListener; @@ -65,9 +64,9 @@ public function testHandleConsoleCommandEventStartsTransactionIfNoSpanIsSetOnHub } /** - * @return Generator + * @return \Generator */ - public function handleConsoleCommandEventStartsTransactionIfNoSpanIsSetOnHubDataProvider(): Generator + public function handleConsoleCommandEventStartsTransactionIfNoSpanIsSetOnHubDataProvider(): \Generator { $transactionContext = new TransactionContext(); $transactionContext->setOp('console.command'); @@ -121,9 +120,9 @@ public function testHandleConsoleCommandEventStartsChildSpanIfSpanIsSetOnHub(Com } /** - * @return Generator + * @return \Generator */ - public function handleConsoleCommandEventStartsChildSpanIfSpanIsSetOnHubDataProvider(): Generator + public function handleConsoleCommandEventStartsChildSpanIfSpanIsSetOnHubDataProvider(): \Generator { yield [ new Command(),