From ab1e3f24558b54bf899f57ba18e2dd6cf077bd89 Mon Sep 17 00:00:00 2001 From: Stephen Vickers Date: Mon, 4 Apr 2022 17:12:12 +0100 Subject: [PATCH] Fix bug with data type in JWT claims using FirebaseClient (#29) --- src/Jwt/ClientInterface.php | 2 +- src/Jwt/FirebaseClient.php | 5 +---- src/Jwt/SpomkyLabsClient.php | 2 +- src/Jwt/WebTokenClient.php | 2 +- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/Jwt/ClientInterface.php b/src/Jwt/ClientInterface.php index 8c79289..ea1f8a7 100644 --- a/src/Jwt/ClientInterface.php +++ b/src/Jwt/ClientInterface.php @@ -98,7 +98,7 @@ public function hasClaim($name); * @param string $name Claim name * @param string $defaultValue Default value * - * @return string The value of the claim with the specified name, or the default value if it does not exist + * @return string|array|object The value of the claim with the specified name, or the default value if it does not exist */ public function getClaim($name, $defaultValue = null); diff --git a/src/Jwt/FirebaseClient.php b/src/Jwt/FirebaseClient.php index 3fb5eea..fce2319 100644 --- a/src/Jwt/FirebaseClient.php +++ b/src/Jwt/FirebaseClient.php @@ -168,7 +168,7 @@ public function hasClaim($name) * @param string $name Claim name * @param string $defaultValue Default value * - * @return string|array The value of the claim with the specified name, or the default value if it does not exist + * @return string|array|object The value of the claim with the specified name, or the default value if it does not exist */ public function getClaim($name, $defaultValue = null) { @@ -177,9 +177,6 @@ public function getClaim($name, $defaultValue = null) } else { $value = $defaultValue; } - if (is_object($value)) { - $value = (array) $value; - } return $value; } diff --git a/src/Jwt/SpomkyLabsClient.php b/src/Jwt/SpomkyLabsClient.php index 7e07bd2..8e1ebbd 100644 --- a/src/Jwt/SpomkyLabsClient.php +++ b/src/Jwt/SpomkyLabsClient.php @@ -191,7 +191,7 @@ public function hasClaim($name) * @param string $name Claim name * @param string $defaultValue Default value * - * @return string The value of the claim with the specified name, or the default value if it does not exist + * @return string|array|object The value of the claim with the specified name, or the default value if it does not exist */ public function getClaim($name, $defaultValue = null) { diff --git a/src/Jwt/WebTokenClient.php b/src/Jwt/WebTokenClient.php index e3854cf..8e7935a 100644 --- a/src/Jwt/WebTokenClient.php +++ b/src/Jwt/WebTokenClient.php @@ -193,7 +193,7 @@ public function hasClaim($name) * @param string $name Claim name * @param string $defaultValue Default value * - * @return string The value of the claim with the specified name, or the default value if it does not exist + * @return string|array|object The value of the claim with the specified name, or the default value if it does not exist */ public function getClaim($name, $defaultValue = null) {