Skip to content

Commit 1d3034c

Browse files
authored
Merge pull request #51 from PawelSuwinski/grantType_getRawData
method getRawData() of grant types not interface compliant and can lead to TypeError
2 parents 115bb70 + f2d8e4b commit 1d3034c

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

src/GrantType/AuthorizationCode.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,9 @@ public function getRawData(SignerInterface $clientCredentialsSigner, $refreshTok
6666
);
6767

6868
$response = $this->client->send($request);
69+
$rawData = json_decode($response->getBody(), true);
6970

70-
return json_decode($response->getBody(), true);
71+
return is_array($rawData) ? $rawData : [];
7172
}
7273

7374
/**

src/GrantType/ClientCredentials.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,9 @@ public function getRawData(SignerInterface $clientCredentialsSigner, $refreshTok
6868
);
6969

7070
$response = $this->client->send($request);
71+
$rawData = json_decode($response->getBody(), true);
7172

72-
return json_decode($response->getBody(), true);
73+
return is_array($rawData) ? $rawData : [];
7374
}
7475

7576
/**

src/GrantType/PasswordCredentials.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,9 @@ public function getRawData(SignerInterface $clientCredentialsSigner, $refreshTok
6666
);
6767

6868
$response = $this->client->send($request);
69+
$rawData = json_decode($response->getBody(), true);
6970

70-
return json_decode($response->getBody(), true);
71+
return is_array($rawData) ? $rawData : [];
7172
}
7273

7374
/**

src/GrantType/RefreshToken.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,9 @@ public function getRawData(SignerInterface $clientCredentialsSigner, $refreshTok
6565
);
6666

6767
$response = $this->client->send($request);
68+
$rawData = json_decode($response->getBody(), true);
6869

69-
return json_decode($response->getBody(), true);
70+
return is_array($rawData) ? $rawData : [];
7071
}
7172

7273
/**

0 commit comments

Comments
 (0)