Skip to content

Commit

Permalink
Fix typing
Browse files Browse the repository at this point in the history
  • Loading branch information
Hectorhammett committed Aug 7, 2024
1 parent 4b9f2ab commit 8b5d36e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/ApplicationDefaultCredentials.php
Original file line number Diff line number Diff line change
Expand Up @@ -366,9 +366,9 @@ private static function onGce(
*/
public static function getDefaultLogger(): null|LoggerInterface
{
$loggingFlag = getenv(self::SDK_DEBUG_FLAG);
$loggingFlag = (string)getenv(self::SDK_DEBUG_FLAG);

if (!$loggingFlag || strtolower(getenv((string) $loggingFlag)) !== 'true') {
if (!$loggingFlag || strtolower($loggingFlag) !== 'true') {
return null;
}

Expand Down
8 changes: 4 additions & 4 deletions src/HttpHandler/Guzzle6HttpHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
use GuzzleHttp\ClientInterface;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\log\LoggerInterface;
use Psr\Log\LoggerInterface;

class Guzzle6HttpHandler
{
Expand Down Expand Up @@ -76,7 +76,7 @@ public function async(RequestInterface $request, array $options = [])
$requestEvent->method = $request->getMethod();
$requestEvent->url = $request->getUri()->__toString();
$requestEvent->headers = $request->getHeaders();
$requestEvent->payload = json_encode($request->getBody()->getContents());
$requestEvent->payload = json_encode($request->getBody()->getContents()) ?? null;

Check failure on line 79 in src/HttpHandler/Guzzle6HttpHandler.php

View workflow job for this annotation

GitHub Actions / PHPStan Static Analysis

Expression on left side of ?? is not nullable.

Check failure on line 79 in src/HttpHandler/Guzzle6HttpHandler.php

View workflow job for this annotation

GitHub Actions / PHPStan Static Analysis

Property Google\Auth\Logger\LogEvent::$payload (array|null) does not accept string|false.
$requestEvent->retryAttempt = $options['retryAttempt'] ?? null;

$this->logRequest($requestEvent);
Expand All @@ -87,8 +87,8 @@ public function async(RequestInterface $request, array $options = [])
$responseEvent = new LogEvent($requestEvent->timestamp);

$responseEvent->headers = $response->getHeaders();
$responseEvent->payload = json_encode($response->getBody()->getContents());
$response->status = $response->getStatusCode();
$responseEvent->payload = json_encode($response->getBody()->getContents()) ?? null;

Check failure on line 90 in src/HttpHandler/Guzzle6HttpHandler.php

View workflow job for this annotation

GitHub Actions / PHPStan Static Analysis

Expression on left side of ?? is not nullable.

Check failure on line 90 in src/HttpHandler/Guzzle6HttpHandler.php

View workflow job for this annotation

GitHub Actions / PHPStan Static Analysis

Property Google\Auth\Logger\LogEvent::$payload (array|null) does not accept string|false.
$responseEvent->status = $response->getStatusCode();

$this->logResponse($responseEvent);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Logger/LoggingTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ private function logResponse(LogEvent $event): void

/**
* @param array<string> $headers
* @return null|array<string>
* @return null|array<string,string>
*/
private function getJwtToken(array $headers): null|array
{
Expand Down

0 comments on commit 8b5d36e

Please sign in to comment.