Skip to content

Commit 6496752

Browse files
fix: php 8.4 deprecation warning about nullable parameters (#462)
* Fix PHP 8.4 deprecation: Implicitly marking parameter as nullable is deprecated * fix php version in build.yml and README.md
1 parent 808027b commit 6496752

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
fail-fast: false
2121
matrix:
2222
os: [ubuntu-latest]
23-
php: ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
23+
php: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
2424

2525
steps:
2626
- name: Checkout

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ the OpenID Connect protocol to set up authentication.
77
A special thanks goes to Justin Richer and Amanda Anganes for their help and support of the protocol.
88

99
# Requirements #
10-
1. PHP 7.0 or greater
10+
1. PHP 7.1 or greater
1111
2. CURL extension
1212
3. JSON extension
1313

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

@@ -1332,7 +1332,7 @@ public function requestUserInfo(string $attribute = null) {
13321332
* @return mixed
13331333
*
13341334
*/
1335-
public function getVerifiedClaims(string $attribute = null) {
1335+
public function getVerifiedClaims(?string $attribute = null) {
13361336

13371337
if($attribute === null) {
13381338
return $this->verifiedClaims;
@@ -1352,7 +1352,7 @@ public function getVerifiedClaims(string $attribute = null) {
13521352
* @return bool|string
13531353
* @throws OpenIDConnectClientException
13541354
*/
1355-
protected function fetchURL(string $url, string $post_body = null, array $headers = []) {
1355+
protected function fetchURL(string $url, ?string $post_body = null, array $headers = []) {
13561356

13571357
// OK cool - then let's create a new cURL resource handle
13581358
$ch = curl_init();
@@ -1626,7 +1626,7 @@ public function register() {
16261626
* @throws OpenIDConnectClientException
16271627
* @throws Exception
16281628
*/
1629-
public function introspectToken(string $token, string $token_type_hint = '', string $clientId = null, string $clientSecret = null) {
1629+
public function introspectToken(string $token, string $token_type_hint = '', ?string $clientId = null, ?string $clientSecret = null) {
16301630
$introspection_endpoint = $this->getProviderConfigValue('introspection_endpoint');
16311631
$token_endpoint_auth_methods_supported = $this->getProviderConfigValue('token_endpoint_auth_methods_supported', ['client_secret_basic']);
16321632

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

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

0 commit comments

Comments
 (0)