From d9c294ae5c1e428b7387e4bd97ff8087aec629c2 Mon Sep 17 00:00:00 2001 From: Martin Linzmayer Date: Mon, 22 Sep 2025 10:17:13 +0200 Subject: [PATCH 1/3] ref(lint): remove psalm and replace annotations with phpstan equivalents --- .github/workflows/ci.yml | 2 +- .github/workflows/static-analysis.yaml | 18 ---- composer.json | 7 +- psalm-baseline.xml | 100 ------------------ psalm.xml.dist | 75 ------------- src/Breadcrumb.php | 2 +- src/Client.php | 6 +- src/ClientInterface.php | 6 +- src/ErrorHandler.php | 18 ++-- src/Event.php | 6 +- src/EventHint.php | 2 +- src/FrameBuilder.php | 6 +- .../FrameContextifierIntegration.php | 2 +- src/Integration/RequestIntegration.php | 4 +- src/Monolog/BreadcrumbHandler.php | 2 +- src/Options.php | 26 ++--- src/Serializer/EnvelopItems/EventItem.php | 2 +- .../EnvelopItems/TransactionItem.php | 2 +- .../Traits/BreadcrumbSerializerTrait.php | 2 +- .../Traits/StacktraceFrameSerializerTrait.php | 2 +- src/StacktraceBuilder.php | 4 +- src/State/HubInterface.php | 12 +-- src/State/Scope.php | 4 +- src/Tracing/GuzzleTracingMiddleware.php | 2 +- src/Tracing/Span.php | 2 +- src/functions.php | 6 +- 26 files changed, 62 insertions(+), 258 deletions(-) delete mode 100644 psalm-baseline.xml delete mode 100644 psalm.xml.dist diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6dee415f4..79d1d8820 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,7 +68,7 @@ jobs: # These dependencies are not used running the tests but can cause deprecation warnings so we remove them before running the tests - name: Remove unused dependencies - run: composer remove vimeo/psalm phpstan/phpstan friendsofphp/php-cs-fixer --dev --no-interaction --no-update + run: composer remove phpstan/phpstan friendsofphp/php-cs-fixer --dev --no-interaction --no-update - name: Set phpunit/phpunit version constraint run: composer require phpunit/phpunit:'${{ matrix.php.phpunit }}' --dev --no-interaction --no-update diff --git a/.github/workflows/static-analysis.yaml b/.github/workflows/static-analysis.yaml index d9e875a52..5e5e28e53 100644 --- a/.github/workflows/static-analysis.yaml +++ b/.github/workflows/static-analysis.yaml @@ -46,21 +46,3 @@ jobs: - name: Run script run: vendor/bin/phpstan analyse - - psalm: - name: Psalm - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v5 - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: '8.3' - - - name: Install dependencies - run: composer update --no-progress --no-interaction --prefer-dist - - - name: Run script - run: vendor/bin/psalm diff --git a/composer.json b/composer.json index 00fb1c5d4..07226e4ef 100644 --- a/composer.json +++ b/composer.json @@ -38,8 +38,7 @@ "phpbench/phpbench": "^1.0", "phpstan/phpstan": "^1.3", "phpunit/phpunit": "^8.5|^9.6", - "symfony/phpunit-bridge": "^5.2|^6.0|^7.0", - "vimeo/psalm": "^4.17" + "symfony/phpunit-bridge": "^5.2|^6.0|^7.0" }, "suggest": { "monolog/monolog": "Allow sending log messages to Sentry by using the included Monolog handler." @@ -64,14 +63,12 @@ "check": [ "@cs-check", "@phpstan", - "@psalm", "@tests" ], "tests": "vendor/bin/phpunit --verbose", "cs-check": "vendor/bin/php-cs-fixer fix --verbose --diff --dry-run", "cs-fix": "vendor/bin/php-cs-fixer fix --verbose --diff", - "phpstan": "vendor/bin/phpstan analyse", - "psalm": "vendor/bin/psalm" + "phpstan": "vendor/bin/phpstan analyse" }, "config": { "sort-packages": true diff --git a/psalm-baseline.xml b/psalm-baseline.xml deleted file mode 100644 index 8dbbbbe27..000000000 --- a/psalm-baseline.xml +++ /dev/null @@ -1,100 +0,0 @@ - - - - - $parsedDsn['host'] - $parsedDsn['path'] - $parsedDsn['scheme'] - $parsedDsn['user'] - - - - - $userIntegration - $userIntegrations - - - - - $record['channel'] - $record['level'] - $record['level'] - $record['message'] - - - getTimestamp - - - Level|int - int|string|Level|LogLevel::* - - - - - CompatibilityLogLevelTrait - - - Level - - - - - CompatibilityProcessingHandlerTrait - - - Level - - - - - $record['channel'] - $record['level'] - $record['message'] - - - $record['context']['exception'] - - - $record['context'] - $record['context'] - - - - - $record['level'] - $record['level'] - $record['message'] - - - $record['context']['exception'] - - - $record['context'] - $record['context'] - - - - - - SentryProfile|null - - - - - (string) $value - - - - - $value - - - representationSerialize - - - - - $transaction - - - diff --git a/psalm.xml.dist b/psalm.xml.dist deleted file mode 100644 index ea60216a6..000000000 --- a/psalm.xml.dist +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Breadcrumb.php b/src/Breadcrumb.php index a5e3116dc..c6d1fbf44 100644 --- a/src/Breadcrumb.php +++ b/src/Breadcrumb.php @@ -323,7 +323,7 @@ public function withTimestamp(float $timestamp): self * * @param array $data Data used to populate the breadcrumb * - * @psalm-param array{ + * @phpstan-param array{ * level: string, * type?: string, * category: string, diff --git a/src/Client.php b/src/Client.php index 3ca82713e..8355acd1c 100644 --- a/src/Client.php +++ b/src/Client.php @@ -58,7 +58,7 @@ class Client implements ClientInterface /** * @var array The stack of integrations * - * @psalm-var array, IntegrationInterface> + * @phpstan-var array, IntegrationInterface> */ private $integrations; @@ -221,11 +221,11 @@ public function captureLastError(?Scope $scope = null, ?EventHint $hint = null): /** * {@inheritdoc} * - * @psalm-template T of IntegrationInterface + * @template T of IntegrationInterface */ public function getIntegration(string $className): ?IntegrationInterface { - /** @psalm-var T|null */ + /** @phpstan-var T|null */ return $this->integrations[$className] ?? null; } diff --git a/src/ClientInterface.php b/src/ClientInterface.php index 0aab383a4..55044ae1b 100644 --- a/src/ClientInterface.php +++ b/src/ClientInterface.php @@ -61,11 +61,11 @@ public function captureEvent(Event $event, ?EventHint $hint = null, ?Scope $scop * * @param string $className The FQCN of the integration * - * @psalm-template T of IntegrationInterface + * @template T of IntegrationInterface * - * @psalm-param class-string $className + * @phpstan-param class-string $className * - * @psalm-return T|null + * @phpstan-return T|null */ public function getIntegration(string $className): ?IntegrationInterface; diff --git a/src/ErrorHandler.php b/src/ErrorHandler.php index ba44df0c6..0839ce32b 100644 --- a/src/ErrorHandler.php +++ b/src/ErrorHandler.php @@ -13,7 +13,7 @@ * error handler more than once is not supported and will lead to nasty * problems. The code is based on the Symfony ErrorHandler component. * - * @psalm-import-type StacktraceFrame from FrameBuilder + * @phpstan-import-type StacktraceFrame from FrameBuilder */ final class ErrorHandler { @@ -44,21 +44,21 @@ final class ErrorHandler /** * @var callable[] List of listeners that will act on each captured error * - * @psalm-var (callable(\ErrorException): void)[] + * @phpstan-var (callable(\ErrorException): void)[] */ private $errorListeners = []; /** * @var callable[] List of listeners that will act of each captured fatal error * - * @psalm-var (callable(FatalErrorException): void)[] + * @phpstan-var (callable(FatalErrorException): void)[] */ private $fatalErrorListeners = []; /** * @var callable[] List of listeners that will act on each captured exception * - * @psalm-var (callable(\Throwable): void)[] + * @phpstan-var (callable(\Throwable): void)[] */ private $exceptionListeners = []; @@ -76,7 +76,7 @@ final class ErrorHandler /** * @var callable|null The previous exception handler, if any * - * @psalm-var null|callable(\Throwable): void + * @phpstan-var null|callable(\Throwable): void */ private $previousExceptionHandler; @@ -250,7 +250,7 @@ public static function registerOnceExceptionHandler(): self * and that must accept a single argument * of type \ErrorException * - * @psalm-param callable(\ErrorException): void $listener + * @phpstan-param callable(\ErrorException): void $listener */ public function addErrorHandlerListener(callable $listener): void { @@ -265,7 +265,7 @@ public function addErrorHandlerListener(callable $listener): void * and that must accept a single argument * of type \Sentry\Exception\FatalErrorException * - * @psalm-param callable(FatalErrorException): void $listener + * @phpstan-param callable(FatalErrorException): void $listener */ public function addFatalErrorHandlerListener(callable $listener): void { @@ -280,7 +280,7 @@ public function addFatalErrorHandlerListener(callable $listener): void * and that must accept a single argument * of type \Throwable * - * @psalm-param callable(\Throwable): void $listener + * @phpstan-param callable(\Throwable): void $listener */ public function addExceptionHandlerListener(callable $listener): void { @@ -460,7 +460,7 @@ private function handleException(\Throwable $exception): void * @param string $file The filename the backtrace was raised in * @param int $line The line number the backtrace was raised at * - * @psalm-param list $backtrace + * @phpstan-param list $backtrace * * @return array */ diff --git a/src/Event.php b/src/Event.php index 18189eb5e..d76552188 100644 --- a/src/Event.php +++ b/src/Event.php @@ -852,13 +852,13 @@ public function setSdkMetadata(string $name, $data): self /** * Gets the SDK metadata. * - * @psalm-template T of string|null + * @template T of string|null * - * @psalm-param T $name + * @phpstan-param T $name * * @return mixed * - * @psalm-return (T is string ? mixed : array|null) + * @phpstan-return (T is string ? mixed : array|null) */ public function getSdkMetadata(?string $name = null) { diff --git a/src/EventHint.php b/src/EventHint.php index 58b6ffc57..71a9e577d 100644 --- a/src/EventHint.php +++ b/src/EventHint.php @@ -40,7 +40,7 @@ final class EventHint /** * Create a EventHint instance from an array of values. * - * @psalm-param array{ + * @phpstan-param array{ * exception?: \Throwable|null, * mechanism?: ExceptionMechanism|null, * stacktrace?: Stacktrace|null, diff --git a/src/FrameBuilder.php b/src/FrameBuilder.php index 8c102ef28..99712435e 100644 --- a/src/FrameBuilder.php +++ b/src/FrameBuilder.php @@ -12,7 +12,7 @@ * * @internal * - * @psalm-type StacktraceFrame array{ + * @phpstan-type StacktraceFrame array{ * function?: string, * line?: int, * file?: string, @@ -54,7 +54,7 @@ public function __construct(Options $options, RepresentationSerializerInterface * @param int $line The line at which the frame originated * @param array $backtraceFrame The raw frame * - * @psalm-param StacktraceFrame $backtraceFrame + * @phpstan-param StacktraceFrame $backtraceFrame */ public function buildFromBacktraceFrame(string $file, int $line, array $backtraceFrame): Frame { @@ -158,7 +158,7 @@ private function isFrameInApp(string $file, ?string $functionName): bool * * @param array $backtraceFrame The frame data * - * @psalm-param StacktraceFrame $backtraceFrame + * @phpstan-param StacktraceFrame $backtraceFrame * * @return array */ diff --git a/src/Integration/FrameContextifierIntegration.php b/src/Integration/FrameContextifierIntegration.php index 8a541d13d..f0ff6f59b 100644 --- a/src/Integration/FrameContextifierIntegration.php +++ b/src/Integration/FrameContextifierIntegration.php @@ -114,7 +114,7 @@ private function addContextToStacktraceFrame(int $maxContextLines, Frame $frame) * * @return array * - * @psalm-return array{ + * @phpstan-return array{ * pre_context: string[], * context_line: string|null, * post_context: string[] diff --git a/src/Integration/RequestIntegration.php b/src/Integration/RequestIntegration.php index 72e17ac77..de33a3f07 100644 --- a/src/Integration/RequestIntegration.php +++ b/src/Integration/RequestIntegration.php @@ -69,7 +69,7 @@ final class RequestIntegration implements IntegrationInterface /** * @var array The options * - * @psalm-var array{ + * @phpstan-var array{ * pii_sanitize_headers: string[] * } */ @@ -81,7 +81,7 @@ final class RequestIntegration implements IntegrationInterface * @param RequestFetcherInterface|null $requestFetcher PSR-7 request fetcher * @param array $options The options * - * @psalm-param array{ + * @phpstan-param array{ * pii_sanitize_headers?: string[] * } $options */ diff --git a/src/Monolog/BreadcrumbHandler.php b/src/Monolog/BreadcrumbHandler.php index bb2b60ea0..569eaaa66 100644 --- a/src/Monolog/BreadcrumbHandler.php +++ b/src/Monolog/BreadcrumbHandler.php @@ -42,7 +42,7 @@ public function __construct(HubInterface $hub, $level = Logger::DEBUG, bool $bub } /** - * @psalm-suppress MoreSpecificImplementedParamType + * @phpstan-suppress MoreSpecificImplementedParamType * * @param LogRecord|array{ * level: int, diff --git a/src/Options.php b/src/Options.php index 5c5c53253..1b18ac5f5 100644 --- a/src/Options.php +++ b/src/Options.php @@ -431,7 +431,7 @@ public function setServerName(string $serverName): self * * @return string[] * - * @psalm-return list> + * @phpstan-return list> */ public function getIgnoreExceptions(): array { @@ -480,7 +480,7 @@ public function setIgnoreTransactions(array $ignoreTransaction): self * Gets a callback that will be invoked before an event is sent to the server. * If `null` is returned it won't be sent. * - * @psalm-return callable(Event, ?EventHint): ?Event + * @phpstan-return callable(Event, ?EventHint): ?Event */ public function getBeforeSendCallback(): callable { @@ -493,7 +493,7 @@ public function getBeforeSendCallback(): callable * * @param callable $callback The callable * - * @psalm-param callable(Event, ?EventHint): ?Event $callback + * @phpstan-param callable(Event, ?EventHint): ?Event $callback */ public function setBeforeSendCallback(callable $callback): self { @@ -508,7 +508,7 @@ public function setBeforeSendCallback(callable $callback): self * Gets a callback that will be invoked before an transaction is sent to the server. * If `null` is returned it won't be sent. * - * @psalm-return callable(Event, ?EventHint): ?Event + * @phpstan-return callable(Event, ?EventHint): ?Event */ public function getBeforeSendTransactionCallback(): callable { @@ -521,7 +521,7 @@ public function getBeforeSendTransactionCallback(): callable * * @param callable $callback The callable * - * @psalm-param callable(Event, ?EventHint): ?Event $callback + * @phpstan-param callable(Event, ?EventHint): ?Event $callback */ public function setBeforeSendTransactionCallback(callable $callback): self { @@ -536,7 +536,7 @@ public function setBeforeSendTransactionCallback(callable $callback): self * Gets a callback that will be invoked before a check-in is sent to the server. * If `null` is returned it won't be sent. * - * @psalm-return callable(Event, ?EventHint): ?Event + * @phpstan-return callable(Event, ?EventHint): ?Event */ public function getBeforeSendCheckInCallback(): callable { @@ -549,7 +549,7 @@ public function getBeforeSendCheckInCallback(): callable * * @param callable $callback The callable * - * @psalm-param callable(Event, ?EventHint): ?Event $callback + * @phpstan-param callable(Event, ?EventHint): ?Event $callback */ public function setBeforeSendCheckInCallback(callable $callback): self { @@ -564,7 +564,7 @@ public function setBeforeSendCheckInCallback(callable $callback): self * Gets a callback that will be invoked before an log is sent to the server. * If `null` is returned it won't be sent. * - * @psalm-return callable(Log): ?Log + * @phpstan-return callable(Log): ?Log */ public function getBeforeSendLogCallback(): callable { @@ -577,7 +577,7 @@ public function getBeforeSendLogCallback(): callable * * @param callable $callback The callable * - * @psalm-param callable(Log): ?Log $callback + * @phpstan-param callable(Log): ?Log $callback */ public function setBeforeSendLogCallback(callable $callback): self { @@ -703,7 +703,7 @@ public function setMaxBreadcrumbs(int $maxBreadcrumbs): self /** * Gets a callback that will be invoked when adding a breadcrumb. * - * @psalm-return callable(Breadcrumb): ?Breadcrumb + * @phpstan-return callable(Breadcrumb): ?Breadcrumb */ public function getBeforeBreadcrumbCallback(): callable { @@ -719,7 +719,7 @@ public function getBeforeBreadcrumbCallback(): callable * * @param callable $callback The callback * - * @psalm-param callable(Breadcrumb): ?Breadcrumb $callback + * @phpstan-param callable(Breadcrumb): ?Breadcrumb $callback */ public function setBeforeBreadcrumbCallback(callable $callback): self { @@ -1050,7 +1050,7 @@ public function setClassSerializers(array $serializers): self /** * Gets a callback that will be invoked when we sample a Transaction. * - * @psalm-return null|callable(Tracing\SamplingContext): float + * @phpstan-return null|callable(Tracing\SamplingContext): float */ public function getTracesSampler(): ?callable { @@ -1063,7 +1063,7 @@ public function getTracesSampler(): ?callable * * @param ?callable $sampler The sampler * - * @psalm-param null|callable(Tracing\SamplingContext): float $sampler + * @phpstan-param null|callable(Tracing\SamplingContext): float $sampler */ public function setTracesSampler(?callable $sampler): self { diff --git a/src/Serializer/EnvelopItems/EventItem.php b/src/Serializer/EnvelopItems/EventItem.php index a656686d7..bf44d6f89 100644 --- a/src/Serializer/EnvelopItems/EventItem.php +++ b/src/Serializer/EnvelopItems/EventItem.php @@ -147,7 +147,7 @@ public static function toEnvelopeItem(Event $event): string /** * @return array * - * @psalm-return array{ + * @phpstan-return array{ * type: string, * value: string, * stacktrace?: array{ diff --git a/src/Serializer/EnvelopItems/TransactionItem.php b/src/Serializer/EnvelopItems/TransactionItem.php index 865d28499..e8a30374c 100644 --- a/src/Serializer/EnvelopItems/TransactionItem.php +++ b/src/Serializer/EnvelopItems/TransactionItem.php @@ -133,7 +133,7 @@ public static function toEnvelopeItem(Event $event): string /** * @return array * - * @psalm-return array{ + * @phpstan-return array{ * span_id: string, * trace_id: string, * parent_span_id?: string, diff --git a/src/Serializer/Traits/BreadcrumbSerializerTrait.php b/src/Serializer/Traits/BreadcrumbSerializerTrait.php index 2299b3bb7..9880bcea7 100644 --- a/src/Serializer/Traits/BreadcrumbSerializerTrait.php +++ b/src/Serializer/Traits/BreadcrumbSerializerTrait.php @@ -14,7 +14,7 @@ trait BreadcrumbSerializerTrait /** * @return array * - * @psalm-return array{ + * @phpstan-return array{ * type: string, * category: string, * level: string, diff --git a/src/Serializer/Traits/StacktraceFrameSerializerTrait.php b/src/Serializer/Traits/StacktraceFrameSerializerTrait.php index bd9f22ccf..db5533a65 100644 --- a/src/Serializer/Traits/StacktraceFrameSerializerTrait.php +++ b/src/Serializer/Traits/StacktraceFrameSerializerTrait.php @@ -14,7 +14,7 @@ trait StacktraceFrameSerializerTrait /** * @return array * - * @psalm-return array{ + * @phpstan-return array{ * filename: string, * lineno: int, * in_app: bool, diff --git a/src/StacktraceBuilder.php b/src/StacktraceBuilder.php index 6360c5560..41d97730e 100644 --- a/src/StacktraceBuilder.php +++ b/src/StacktraceBuilder.php @@ -11,7 +11,7 @@ * This class builds {@see Stacktrace} objects from an instance of an exception * or from a backtrace. * - * @psalm-import-type StacktraceFrame from FrameBuilder + * @phpstan-import-type StacktraceFrame from FrameBuilder */ final class StacktraceBuilder { @@ -52,7 +52,7 @@ public function buildFromException(\Throwable $exception): Stacktrace * @param string $file The file where the backtrace originated from * @param int $line The line from which the backtrace originated from * - * @psalm-param list $backtrace + * @phpstan-param list $backtrace */ public function buildFromBacktrace(array $backtrace, string $file, int $line): Stacktrace { diff --git a/src/State/HubInterface.php b/src/State/HubInterface.php index 227a8451e..123fb928e 100644 --- a/src/State/HubInterface.php +++ b/src/State/HubInterface.php @@ -51,13 +51,13 @@ public function popScope(): bool; * * @param callable $callback The callback to be executed * - * @psalm-template T + * @template T * - * @psalm-param callable(Scope): T $callback + * @phpstan-param callable(Scope): T $callback * * @return mixed|void The callback's return value, upon successful execution * - * @psalm-return T + * @phpstan-return T */ public function withScope(callable $callback); @@ -111,11 +111,11 @@ public function captureCheckIn(string $slug, CheckInStatus $status, $duration = * * @param string $className The FQCN of the integration * - * @psalm-template T of IntegrationInterface + * @template T of IntegrationInterface * - * @psalm-param class-string $className + * @phpstan-param class-string $className * - * @psalm-return T|null + * @phpstan-return T|null */ public function getIntegration(string $className): ?IntegrationInterface; diff --git a/src/State/Scope.php b/src/State/Scope.php index e4e054c3c..22eef8a25 100644 --- a/src/State/Scope.php +++ b/src/State/Scope.php @@ -66,7 +66,7 @@ class Scope /** * @var callable[] List of event processors * - * @psalm-var array + * @phpstan-var array */ private $eventProcessors = []; @@ -78,7 +78,7 @@ class Scope /** * @var callable[] List of event processors * - * @psalm-var array + * @phpstan-var array */ private static $globalEventProcessors = []; diff --git a/src/Tracing/GuzzleTracingMiddleware.php b/src/Tracing/GuzzleTracingMiddleware.php index ee2ce0f0f..97c750e5b 100644 --- a/src/Tracing/GuzzleTracingMiddleware.php +++ b/src/Tracing/GuzzleTracingMiddleware.php @@ -79,7 +79,7 @@ public static function trace(?HubInterface $hub = null): \Closure $response = null; - /** @psalm-suppress UndefinedClass */ + /** @phpstan-ignore UndefinedClass */ if ($responseOrException instanceof ResponseInterface) { $response = $responseOrException; } elseif ($responseOrException instanceof GuzzleRequestException) { diff --git a/src/Tracing/Span.php b/src/Tracing/Span.php index baf04c679..600f1d923 100644 --- a/src/Tracing/Span.php +++ b/src/Tracing/Span.php @@ -393,7 +393,7 @@ public function setData(array $data) * * @return array * - * @psalm-return array{ + * @phpstan-return array{ * data?: array, * description?: string, * op?: string, diff --git a/src/functions.php b/src/functions.php index 77e27f525..89cca2d0e 100644 --- a/src/functions.php +++ b/src/functions.php @@ -198,13 +198,13 @@ function configureScope(callable $callback): void * * @param callable $callback The callback to be executed * - * @psalm-template T + * @template T * - * @psalm-param callable(Scope): T $callback + * @phpstan-param callable(Scope): T $callback * * @return mixed|void The callback's return value, upon successful execution * - * @psalm-return T + * @phpstan-return T */ function withScope(callable $callback) { From 0f882520968e02bddcccb0a9d62d09b95e0b52d6 Mon Sep 17 00:00:00 2001 From: Martin Linzmayer Date: Mon, 22 Sep 2025 12:04:28 +0200 Subject: [PATCH 2/3] lints --- phpstan-baseline.neon | 10 ---------- src/Monolog/BreadcrumbHandler.php | 5 ++--- src/Serializer/EnvelopItems/TransactionItem.php | 2 +- src/Tracing/GuzzleTracingMiddleware.php | 5 ++--- 4 files changed, 5 insertions(+), 17 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 5b0382806..075fcad3c 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -255,16 +255,6 @@ parameters: count: 1 path: src/Serializer/AbstractSerializer.php - - - message: "#^Call to method getResponse\\(\\) on an unknown class GuzzleHttp\\\\Exception\\\\RequestException\\.$#" - count: 1 - path: src/Tracing/GuzzleTracingMiddleware.php - - - - message: "#^Class GuzzleHttp\\\\Exception\\\\RequestException not found\\.$#" - count: 1 - path: src/Tracing/GuzzleTracingMiddleware.php - - message: "#^Property Sentry\\\\Tracing\\\\PropagationContext\\:\\:\\$parentSampled is never read, only written\\.$#" count: 1 diff --git a/src/Monolog/BreadcrumbHandler.php b/src/Monolog/BreadcrumbHandler.php index 569eaaa66..739ab8b88 100644 --- a/src/Monolog/BreadcrumbHandler.php +++ b/src/Monolog/BreadcrumbHandler.php @@ -42,9 +42,8 @@ public function __construct(HubInterface $hub, $level = Logger::DEBUG, bool $bub } /** - * @phpstan-suppress MoreSpecificImplementedParamType - * - * @param LogRecord|array{ + * @param array|LogRecord $record + * @phpstan-param LogRecord|array{ * level: int, * channel: string, * datetime: \DateTimeImmutable, diff --git a/src/Serializer/EnvelopItems/TransactionItem.php b/src/Serializer/EnvelopItems/TransactionItem.php index e8a30374c..1bb9fa21a 100644 --- a/src/Serializer/EnvelopItems/TransactionItem.php +++ b/src/Serializer/EnvelopItems/TransactionItem.php @@ -143,7 +143,7 @@ public static function toEnvelopeItem(Event $event): string * description?: string, * op?: string, * data?: array, - * tags?: array + * tags?: array, * _metrics_summary?: array * } */ diff --git a/src/Tracing/GuzzleTracingMiddleware.php b/src/Tracing/GuzzleTracingMiddleware.php index 97c750e5b..c697a2feb 100644 --- a/src/Tracing/GuzzleTracingMiddleware.php +++ b/src/Tracing/GuzzleTracingMiddleware.php @@ -79,10 +79,9 @@ public static function trace(?HubInterface $hub = null): \Closure $response = null; - /** @phpstan-ignore UndefinedClass */ - if ($responseOrException instanceof ResponseInterface) { + if (interface_exists(ResponseInterface::class) && $responseOrException instanceof ResponseInterface) { $response = $responseOrException; - } elseif ($responseOrException instanceof GuzzleRequestException) { + } elseif (class_exists(GuzzleRequestException::class) && $responseOrException instanceof GuzzleRequestException) { $response = $responseOrException->getResponse(); } From cd74f63f42a3291b12d6126cc747ead3caacf6ec Mon Sep 17 00:00:00 2001 From: Martin Linzmayer Date: Mon, 22 Sep 2025 12:04:50 +0200 Subject: [PATCH 3/3] lints --- src/Monolog/BreadcrumbHandler.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Monolog/BreadcrumbHandler.php b/src/Monolog/BreadcrumbHandler.php index 739ab8b88..dab56a083 100644 --- a/src/Monolog/BreadcrumbHandler.php +++ b/src/Monolog/BreadcrumbHandler.php @@ -43,6 +43,7 @@ public function __construct(HubInterface $hub, $level = Logger::DEBUG, bool $bub /** * @param array|LogRecord $record + * * @phpstan-param LogRecord|array{ * level: int, * channel: string,