Skip to content

Commit 7c7f4bc

Browse files
committed
chore: Mitigate PHP8.4 deprecation warnings (#570)
1 parent 8b0a51b commit 7c7f4bc

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/CachedKeySet.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ public function __construct(
8080
ClientInterface $httpClient,
8181
RequestFactoryInterface $httpFactory,
8282
CacheItemPoolInterface $cache,
83-
int $expiresAfter = null,
83+
?int $expiresAfter = null,
8484
bool $rateLimit = false,
85-
string $defaultAlg = null
85+
?string $defaultAlg = null
8686
) {
8787
$this->jwksUri = $jwksUri;
8888
$this->httpClient = $httpClient;

src/JWK.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class JWK
5252
*
5353
* @uses parseKey
5454
*/
55-
public static function parseKeySet(array $jwks, string $defaultAlg = null): array
55+
public static function parseKeySet(array $jwks, ?string $defaultAlg = null): array
5656
{
5757
$keys = [];
5858

@@ -93,7 +93,7 @@ public static function parseKeySet(array $jwks, string $defaultAlg = null): arra
9393
*
9494
* @uses createPemFromModulusAndExponent
9595
*/
96-
public static function parseKey(array $jwk, string $defaultAlg = null): ?Key
96+
public static function parseKey(array $jwk, ?string $defaultAlg = null): ?Key
9797
{
9898
if (empty($jwk)) {
9999
throw new InvalidArgumentException('JWK must not be empty');

src/JWT.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ class JWT
9696
public static function decode(
9797
string $jwt,
9898
$keyOrKeyArray,
99-
stdClass &$headers = null
99+
?stdClass &$headers = null
100100
): stdClass {
101101
// Validate JWT
102102
$timestamp = \is_null(static::$timestamp) ? \time() : static::$timestamp;
@@ -200,8 +200,8 @@ public static function encode(
200200
array $payload,
201201
$key,
202202
string $alg,
203-
string $keyId = null,
204-
array $head = null
203+
?string $keyId = null,
204+
?array $head = null
205205
): string {
206206
$header = ['typ' => 'JWT'];
207207
if (isset($head) && \is_array($head)) {

0 commit comments

Comments
 (0)