Context
app/GitHub/ChecksClient.php line 245 calls \$e->hasResponse() on a GuzzleException typed parameter. The hasResponse() method only exists on GuzzleHttp\Exception\RequestException, not on the GuzzleException interface.
The bug
private function logError(string \$method, GuzzleException \$e): void
{
echo "::error::GitHub API error in {\$method}: {\$e->getMessage()}\n";
if (\$e->hasResponse()) { // <-- hasResponse() not on GuzzleException interface
Fix
Add an instanceof check:
private function logError(string \$method, GuzzleException \$e): void
{
echo "::error::GitHub API error in {\$method}: {\$e->getMessage()}\n";
if (\$e instanceof \GuzzleHttp\Exception\RequestException && \$e->hasResponse()) {
Acceptance
- PHPStan level 6+ passes without type errors on this method
- Existing ChecksClient tests still pass
Context
app/GitHub/ChecksClient.phpline 245 calls\$e->hasResponse()on aGuzzleExceptiontyped parameter. ThehasResponse()method only exists onGuzzleHttp\Exception\RequestException, not on theGuzzleExceptioninterface.The bug
Fix
Add an instanceof check:
Acceptance