Skip to content

Commit 6cc40b2

Browse files
committed
fix phpstan
1 parent 0dfbf7d commit 6cc40b2

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

src/AuthHandler/Guzzle6AuthHandler.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,21 @@ public function attachCredentials(
4040
);
4141
}
4242

43-
return $this->attachCredentialsCache($http, $credentials, $tokenCallback);
43+
return $this->attachToHttp($http, $credentials, $tokenCallback);
4444
}
4545

4646
public function attachCredentialsCache(
4747
ClientInterface $http,
4848
FetchAuthTokenCache $credentials,
4949
?callable $tokenCallback = null
50+
) {
51+
return $this->attachToHttp($http, $credentials, $tokenCallback);
52+
}
53+
54+
private function attachToHttp(
55+
ClientInterface $http,
56+
FetchAuthTokenInterface $credentials,
57+
?callable $tokenCallback = null
5058
) {
5159
// if we end up needing to make an HTTP request to retrieve credentials, we
5260
// can use our existing one, but we need to throw exceptions so the error
@@ -63,9 +71,7 @@ public function attachCredentialsCache(
6371
$config['handler']->remove('google_auth');
6472
$config['handler']->push($middleware, 'google_auth');
6573
$config['auth'] = 'google_auth';
66-
$http = new Client($config);
67-
68-
return $http;
74+
return new Client($config);
6975
}
7076

7177
public function attachToken(ClientInterface $http, array $token, array $scopes)

0 commit comments

Comments
 (0)