Skip to content

ref(agent): Drop redundant string cast in AgentClient to remove Mago baseline entry - #2361

Merged
Litarnus merged 1 commit into
masterfrom
junior/baseline-agent-client-redundant-cast
Nov 13, 2026
Merged

Litarnus merged 1 commit into
masterfrom
junior/baseline-agent-client-redundant-cast

Conversation

@sentry-junior

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

Copy link
Copy Markdown
Contributor

Removes this entry from analysis-baseline.toml:

Redundant cast to (string): the expression already has this type. (redundant-cast, src/Agent/Transport/AgentClient.php)

This drops the (string) cast around substr($payload, $totalWrittenBytes) in AgentClient::writePayload().

It's safe on every supported PHP version: the loop only runs while $totalWrittenBytes < $payloadLength, so the offset is always inside the payload. On PHP 7.x substr() only returns false when the offset is at or past the end of the string, which can't happen here, so the cast never did anything.

PHPStan reports no errors, Mago reports no new issues, and the tests/HttpClient suite fails the same way with and without this change. The failing tests are the agent-unavailable cases, which depend on a TCP connect to 192.0.2.1 failing, and the sandbox network accepts that connect.

via automation sched_a59acc45df166a80a839d0b32321e740 · Run ID sched_a59acc45df166a80a839d0b32321e740:1794582238204.

--

View Session [Sentry]

@sentry-junior
sentry-junior Bot requested review from a team and stayallive as code owners November 13, 2026 15:07
@Litarnus
Litarnus merged commit f479f21 into master Nov 13, 2026
58 checks passed
@Litarnus
Litarnus deleted the junior/baseline-agent-client-redundant-cast branch November 13, 2026 15:15
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