Skip to content

ref(integration): Only use string PATH_INFO as transaction to drop PHPStan baseline entry - #2364

Merged
Litarnus merged 2 commits into
masterfrom
junior/phpstan-transaction-integration-path-info
Nov 16, 2026
Merged

Litarnus merged 2 commits into
masterfrom
junior/phpstan-transaction-integration-path-info

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

Removes this entry from phpstan-baseline.neon:

Parameter #1 $transaction of method Sentry\Event::setTransaction() expects string|null, mixed given. (argument.type, src/Integration/TransactionIntegration.php)

TransactionIntegration now falls back to $_SERVER['PATH_INFO'] only when it is a string, the same way it already checks the transaction hint value. PHP SAPIs always set PATH_INFO as a string, so normal requests behave the same. If something puts a non-string value there, the event keeps a null transaction instead of hitting a TypeError inside the event processor.

via automation sched_a59acc45df166a80a839d0b32321e740 · Run ID sched_a59acc45df166a80a839d0b32321e740:1794733200000.

--

View Session [Sentry]

@Litarnus

Copy link
Copy Markdown
Collaborator

Mago raised a point here, can you check that we don't introduce a mago failure by adding a redundant check

@sentry-junior

sentry-junior Bot commented Nov 16, 2026

Copy link
Copy Markdown
Contributor Author

Good catch, @Litarnus. The isset($_SERVER['PATH_INFO']) && \is_string(...) version did add a new Mago redundant-logical-operation warning on that line. Mago types PATH_INFO as a string, so it saw the is_string() as always true. Mago warnings don't change the exit code, so I missed it.

I changed it to \is_string($_SERVER['PATH_INFO'] ?? null) in e0cd41c. Mago output now matches master, with no TransactionIntegration issue even with --ignore-baseline. PHPStan still narrows the value, so the baseline entry stays removed.

@Litarnus
Litarnus marked this pull request as ready for review November 16, 2026 13:19
@Litarnus
Litarnus requested review from a team and stayallive as code owners November 16, 2026 13:19
@Litarnus
Litarnus merged commit 926220e into master Nov 16, 2026
58 checks passed
@Litarnus
Litarnus deleted the junior/phpstan-transaction-integration-path-info branch November 16, 2026 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant