Skip to content

Commit c66b6a5

Browse files
Fix PHP 8.4 deprecation: Implicitly marking parameter as nullable is deprecated
1 parent f7c91b9 commit c66b6a5

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "Bare-bones OpenID Connect client",
44
"license": "Apache-2.0",
55
"require": {
6-
"php": ">=7.0",
6+
"php": ">=7.1",
77
"ext-json": "*",
88
"ext-curl": "*",
99
"phpseclib/phpseclib": "^3.0.7"

src/OpenIDConnectClient.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ class OpenIDConnectClient
259259
* @param string|null $client_secret optional
260260
* @param string|null $issuer
261261
*/
262-
public function __construct(string $provider_url = null, string $client_id = null, string $client_secret = null, string $issuer = null) {
262+
public function __construct(?string $provider_url = null, ?string $client_id = null, ?string $client_secret = null, ?string $issuer = null) {
263263
$this->setProviderURL($provider_url);
264264
if ($issuer === null) {
265265
$this->setIssuer($provider_url);
@@ -1189,7 +1189,7 @@ protected function validateIssuer(string $iss): bool
11891189
* @return bool
11901190
* @throws OpenIDConnectClientException
11911191
*/
1192-
protected function verifyJWTClaims($claims, string $accessToken = null): bool
1192+
protected function verifyJWTClaims($claims, ?string $accessToken = null): bool
11931193
{
11941194
if(isset($claims->at_hash, $accessToken)) {
11951195
if(isset($this->getIdTokenHeader()->alg) && $this->getIdTokenHeader()->alg !== 'none') {
@@ -1258,7 +1258,7 @@ protected function decodeJWT(string $jwt, int $section = 0) {
12581258
*
12591259
* @throws OpenIDConnectClientException
12601260
*/
1261-
public function requestUserInfo(string $attribute = null) {
1261+
public function requestUserInfo(?string $attribute = null) {
12621262

12631263
$user_info_endpoint = $this->getProviderConfigValue('userinfo_endpoint');
12641264
$schema = 'openid';
@@ -1335,7 +1335,7 @@ public function requestUserInfo(string $attribute = null) {
13351335
* @return mixed
13361336
*
13371337
*/
1338-
public function getVerifiedClaims(string $attribute = null) {
1338+
public function getVerifiedClaims(?string $attribute = null) {
13391339

13401340
if($attribute === null) {
13411341
return $this->verifiedClaims;
@@ -1355,7 +1355,7 @@ public function getVerifiedClaims(string $attribute = null) {
13551355
* @return bool|string
13561356
* @throws OpenIDConnectClientException
13571357
*/
1358-
protected function fetchURL(string $url, string $post_body = null, array $headers = []) {
1358+
protected function fetchURL(string $url, ?string $post_body = null, array $headers = []) {
13591359

13601360
// OK cool - then let's create a new cURL resource handle
13611361
$ch = curl_init();
@@ -1629,7 +1629,7 @@ public function register() {
16291629
* @throws OpenIDConnectClientException
16301630
* @throws Exception
16311631
*/
1632-
public function introspectToken(string $token, string $token_type_hint = '', string $clientId = null, string $clientSecret = null) {
1632+
public function introspectToken(string $token, string $token_type_hint = '', ?string $clientId = null, ?string $clientSecret = null) {
16331633
$introspection_endpoint = $this->getProviderConfigValue('introspection_endpoint');
16341634
$token_endpoint_auth_methods_supported = $this->getProviderConfigValue('token_endpoint_auth_methods_supported', ['client_secret_basic']);
16351635

@@ -1670,7 +1670,7 @@ public function introspectToken(string $token, string $token_type_hint = '', str
16701670
* @return mixed
16711671
* @throws OpenIDConnectClientException
16721672
*/
1673-
public function revokeToken(string $token, string $token_type_hint = '', string $clientId = null, string $clientSecret = null) {
1673+
public function revokeToken(string $token, string $token_type_hint = '', ?string $clientId = null, ?string $clientSecret = null) {
16741674
$revocation_endpoint = $this->getProviderConfigValue('revocation_endpoint');
16751675

16761676
$post_data = ['token' => $token];

0 commit comments

Comments
 (0)