Skip to content

Commit

Permalink
PR self review
Browse files Browse the repository at this point in the history
  • Loading branch information
yash30201 committed Dec 19, 2023
1 parent 3fc4be9 commit 1c383b0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/Credentials/ServiceAccountCredentials.php
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ public function getProjectId(callable $httpHandler = null)
public function updateMetadata(
$metadata,
$authUri = null,
callable $httpHandler = null,
callable $httpHandler = null
) {
// scope exists. use oauth implementation
if (!$this->useSelfSignedJwt()) {
Expand Down
3 changes: 2 additions & 1 deletion src/Credentials/ServiceAccountJwtAccessCredentials.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,15 @@ public function __construct($jsonKey, $scope = null)
public function updateMetadata(
$metadata,
$authUri = null,
callable $httpHandler = null,
callable $httpHandler = null
) {
$scope = $this->auth->getScope();
if (empty($authUri) && empty($scope)) {
return $metadata;
}

$this->auth->setAudience($authUri);

return parent::updateMetadata($metadata, $authUri, $httpHandler);
}

Expand Down
20 changes: 2 additions & 18 deletions src/Credentials/UserRefreshCredentials.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public function __construct(
* @param callable $httpHandler
* @param array $metricsHeader [optional] Metrics headers to be inserted
* into the token endpoint request present.
* This is passed from ImersonatedServiceAccountCredentials as it uses
* This could be passed from ImersonatedServiceAccountCredentials as it uses
* UserRefreshCredentials as source credentials.
*
* @return array<mixed> {
Expand All @@ -123,7 +123,7 @@ public function __construct(
public function fetchAuthToken(callable $httpHandler = null, array $metricsHeader = [])

Check failure on line 123 in src/Credentials/UserRefreshCredentials.php

View workflow job for this annotation

GitHub Actions / PHPStan Static Analysis

Method Google\Auth\Credentials\UserRefreshCredentials::fetchAuthToken() has parameter $metricsHeader with no value type specified in iterable type array.
{
// ImersonatedServiceAccountCredentials can propagate it's own header value, hence
// the check for empty metricsHeaders
// we'll pass them if present.
if (empty($metricsHeader)) {
// We don't support id token endpoint requests as of now for User Cred
$isAccessTokenRequest = true;
Expand All @@ -135,22 +135,6 @@ public function fetchAuthToken(callable $httpHandler = null, array $metricsHeade
return $this->auth->fetchAuthToken($httpHandler, $metricsHeader);
}

/**
* Updates metadata with the authorization token.
*
* @param array<mixed> $metadata metadata hashmap
* @param string $authUri optional auth uri
* @param callable $httpHandler callback which delivers psr7 request
* @return array<mixed> updated metadata hashmap
*/
public function updateMetadata(
$metadata,
$authUri = null,
callable $httpHandler = null,
): array {
return parent::updateMetadata($metadata, $authUri, $httpHandler);
}

/**
* @return string
*/
Expand Down

0 comments on commit 1c383b0

Please sign in to comment.