Skip to content

fix: drop redundant null check in 503 burst-throttle handler#1

Merged
Brentjes merged 1 commit intomainfrom
fix/phpstan-ternary-always-true
Apr 21, 2026
Merged

fix: drop redundant null check in 503 burst-throttle handler#1
Brentjes merged 1 commit intomainfrom
fix/phpstan-ternary-always-true

Conversation

@Brentjes
Copy link
Copy Markdown
Contributor

Summary

  • Resolves PHPStan level-5 ternary.alwaysTrue error at Transport/JsonRpcClient.php:287
  • Inside the if ($statusCode === 503) branch, $response is already proven non-null ($statusCode was derived from it above, so any non-zero value implies a response exists)
  • No behavior change — only drops a redundant ternary and adds a clarifying comment

Context

Static-analysis CI has been failing on main since PHPStan 2.x tightened impurity inference. This is the only outstanding error.

Test plan

  • vendor/bin/phpstan analyse — 0 errors
  • vendor/bin/phpunit — 70/70 passing, 305 assertions
  • vendor/bin/php-cs-fixer fix --dry-run — clean

$response is guaranteed non-null inside the `if ($statusCode === 503)`
branch — $statusCode was derived from $response->getStatusCode() above,
so a non-zero status implies the response exists. PHPStan 2.x flags the
ternary as always-true (level 5).

No behavior change.
@Brentjes Brentjes self-assigned this Apr 21, 2026
@Brentjes Brentjes merged commit 9cde7fe into main Apr 21, 2026
6 checks passed
@Brentjes Brentjes deleted the fix/phpstan-ternary-always-true branch April 21, 2026 07:09
Brentjes added a commit that referenced this pull request Apr 21, 2026
$response is guaranteed non-null inside the `if ($statusCode === 503)`
branch — $statusCode was derived from $response->getStatusCode() above,
so a non-zero status implies the response exists. PHPStan 2.x flags the
ternary as always-true (level 5).

No behavior change.
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