Skip to content

Commit 1c715c2

Browse files
authored
chore add explicit null to nullable types for PHP 8.4 (#1075)
1 parent 42c7a32 commit 1c715c2

File tree

12 files changed

+20
-20
lines changed

12 files changed

+20
-20
lines changed

src/OAuth2/ClientAssertionType/HttpBasic.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public function getClientId()
112112
*
113113
* @ingroup oauth2_section_2
114114
*/
115-
public function getClientCredentials(RequestInterface $request, ResponseInterface $response = null)
115+
public function getClientCredentials(RequestInterface $request, ?ResponseInterface $response = null)
116116
{
117117
if (!is_null($request->headers('PHP_AUTH_USER')) && !is_null($request->headers('PHP_AUTH_PW'))) {
118118
return array('client_id' => $request->headers('PHP_AUTH_USER'), 'client_secret' => $request->headers('PHP_AUTH_PW'));

src/OAuth2/Controller/AuthorizeController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class AuthorizeController implements AuthorizeControllerInterface
7878
* );
7979
* @endcode
8080
*/
81-
public function __construct(ClientInterface $clientStorage, array $responseTypes = array(), array $config = array(), ScopeInterface $scopeUtil = null)
81+
public function __construct(ClientInterface $clientStorage, array $responseTypes = array(), array $config = array(), ?ScopeInterface $scopeUtil = null)
8282
{
8383
$this->clientStorage = $clientStorage;
8484
$this->responseTypes = $responseTypes;

src/OAuth2/Controller/ResourceController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class ResourceController implements ResourceControllerInterface
4747
* @param array $config
4848
* @param ScopeInterface $scopeUtil
4949
*/
50-
public function __construct(TokenTypeInterface $tokenType, AccessTokenInterface $tokenStorage, $config = array(), ScopeInterface $scopeUtil = null)
50+
public function __construct(TokenTypeInterface $tokenType, AccessTokenInterface $tokenStorage, $config = array(), ?ScopeInterface $scopeUtil = null)
5151
{
5252
$this->tokenType = $tokenType;
5353
$this->tokenStorage = $tokenStorage;

src/OAuth2/Controller/TokenController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class TokenController implements TokenControllerInterface
5454
* @param ScopeInterface $scopeUtil
5555
* @throws InvalidArgumentException
5656
*/
57-
public function __construct(AccessTokenInterface $accessToken, ClientInterface $clientStorage, array $grantTypes = array(), ClientAssertionTypeInterface $clientAssertionType = null, ScopeInterface $scopeUtil = null)
57+
public function __construct(AccessTokenInterface $accessToken, ClientInterface $clientStorage, array $grantTypes = array(), ?ClientAssertionTypeInterface $clientAssertionType = null, ?ScopeInterface $scopeUtil = null)
5858
{
5959
if (is_null($clientAssertionType)) {
6060
foreach ($grantTypes as $grantType) {

src/OAuth2/GrantType/JwtBearer.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class JwtBearer implements GrantTypeInterface, ClientAssertionTypeInterface
3737
* @param EncryptionInterface|JWT $jwtUtil - OPTONAL The class used to decode, encode and verify JWTs.
3838
* @param array $config
3939
*/
40-
public function __construct(JwtBearerInterface $storage, $audience, EncryptionInterface $jwtUtil = null, array $config = array())
40+
public function __construct(JwtBearerInterface $storage, $audience, ?EncryptionInterface $jwtUtil = null, array $config = array())
4141
{
4242
$this->storage = $storage;
4343
$this->audience = $audience;

src/OAuth2/OpenID/Controller/UserInfoController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class UserInfoController extends ResourceController implements UserInfoControlle
3030
* @param array $config
3131
* @param ScopeInterface $scopeUtil
3232
*/
33-
public function __construct(TokenTypeInterface $tokenType, AccessTokenInterface $tokenStorage, UserClaimsInterface $userClaimsStorage, $config = array(), ScopeInterface $scopeUtil = null)
33+
public function __construct(TokenTypeInterface $tokenType, AccessTokenInterface $tokenStorage, UserClaimsInterface $userClaimsStorage, $config = array(), ?ScopeInterface $scopeUtil = null)
3434
{
3535
parent::__construct($tokenType, $tokenStorage, $config, $scopeUtil);
3636

src/OAuth2/OpenID/ResponseType/IdToken.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class IdToken implements IdTokenInterface
3838
* @param EncryptionInterface $encryptionUtil
3939
* @throws LogicException
4040
*/
41-
public function __construct(UserClaimsInterface $userClaimsStorage, PublicKeyInterface $publicKeyStorage, array $config = array(), EncryptionInterface $encryptionUtil = null)
41+
public function __construct(UserClaimsInterface $userClaimsStorage, PublicKeyInterface $publicKeyStorage, array $config = array(), ?EncryptionInterface $encryptionUtil = null)
4242
{
4343
$this->userClaimsStorage = $userClaimsStorage;
4444
$this->publicKeyStorage = $publicKeyStorage;

src/OAuth2/Request.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class Request implements RequestInterface
3434
*
3535
* @api
3636
*/
37-
public function __construct(array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = null, array $headers = null)
37+
public function __construct(array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = null, ?array $headers = null)
3838
{
3939
$this->initialize($query, $request, $attributes, $cookies, $files, $server, $content, $headers);
4040
}
@@ -55,7 +55,7 @@ public function __construct(array $query = array(), array $request = array(), ar
5555
*
5656
* @api
5757
*/
58-
public function initialize(array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = null, array $headers = null)
58+
public function initialize(array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = null, ?array $headers = null)
5959
{
6060
$this->request = $request;
6161
$this->query = $query;

src/OAuth2/ResponseType/AccessToken.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class AccessToken implements AccessTokenInterface
3838
* );
3939
* @endcode
4040
*/
41-
public function __construct(AccessTokenStorageInterface $tokenStorage, RefreshTokenInterface $refreshStorage = null, array $config = array())
41+
public function __construct(AccessTokenStorageInterface $tokenStorage, ?RefreshTokenInterface $refreshStorage = null, array $config = array())
4242
{
4343
$this->tokenStorage = $tokenStorage;
4444
$this->refreshStorage = $refreshStorage;

src/OAuth2/ResponseType/JwtAccessToken.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class JwtAccessToken extends AccessToken
2626
* or just the token ID is stored
2727
* @param EncryptionInterface $encryptionUtil -
2828
*/
29-
public function __construct(PublicKeyInterface $publicKeyStorage = null, AccessTokenStorageInterface $tokenStorage = null, RefreshTokenInterface $refreshStorage = null, array $config = array(), EncryptionInterface $encryptionUtil = null)
29+
public function __construct(?PublicKeyInterface $publicKeyStorage = null, ?AccessTokenStorageInterface $tokenStorage = null, ?RefreshTokenInterface $refreshStorage = null, array $config = array(), ?EncryptionInterface $encryptionUtil = null)
3030
{
3131
$this->publicKeyStorage = $publicKeyStorage;
3232
$config = array_merge(array(

src/OAuth2/Server.php

+8-8
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ class Server implements ResourceControllerInterface,
150150
*
151151
* @ingroup oauth2_section_7
152152
*/
153-
public function __construct($storage = array(), array $config = array(), array $grantTypes = array(), array $responseTypes = array(), TokenTypeInterface $tokenType = null, ScopeInterface $scopeUtil = null, ClientAssertionTypeInterface $clientAssertionType = null)
153+
public function __construct($storage = array(), array $config = array(), array $grantTypes = array(), array $responseTypes = array(), ?TokenTypeInterface $tokenType = null, ?ScopeInterface $scopeUtil = null, ?ClientAssertionTypeInterface $clientAssertionType = null)
154154
{
155155
$storage = is_array($storage) ? $storage : array($storage);
156156
$this->storages = array();
@@ -289,7 +289,7 @@ public function setUserInfoController(UserInfoControllerInterface $userInfoContr
289289
*
290290
* @see http://openid.net/specs/openid-connect-core-1_0.html#UserInfo
291291
*/
292-
public function handleUserInfoRequest(RequestInterface $request, ResponseInterface $response = null)
292+
public function handleUserInfoRequest(RequestInterface $request, ?ResponseInterface $response = null)
293293
{
294294
$this->response = is_null($response) ? new Response() : $response;
295295
$this->getUserInfoController()->handleUserInfoRequest($request, $this->response);
@@ -315,7 +315,7 @@ public function handleUserInfoRequest(RequestInterface $request, ResponseInterfa
315315
*
316316
* @ingroup oauth2_section_4
317317
*/
318-
public function handleTokenRequest(RequestInterface $request, ResponseInterface $response = null)
318+
public function handleTokenRequest(RequestInterface $request, ?ResponseInterface $response = null)
319319
{
320320
$this->response = is_null($response) ? new Response() : $response;
321321
$this->getTokenController()->handleTokenRequest($request, $this->response);
@@ -328,7 +328,7 @@ public function handleTokenRequest(RequestInterface $request, ResponseInterface
328328
* @param ResponseInterface $response - Response object
329329
* @return mixed
330330
*/
331-
public function grantAccessToken(RequestInterface $request, ResponseInterface $response = null)
331+
public function grantAccessToken(RequestInterface $request, ?ResponseInterface $response = null)
332332
{
333333
$this->response = is_null($response) ? new Response() : $response;
334334
$value = $this->getTokenController()->grantAccessToken($request, $this->response);
@@ -346,7 +346,7 @@ public function grantAccessToken(RequestInterface $request, ResponseInterface $r
346346
* @param ResponseInterface $response
347347
* @return Response|ResponseInterface
348348
*/
349-
public function handleRevokeRequest(RequestInterface $request, ResponseInterface $response = null)
349+
public function handleRevokeRequest(RequestInterface $request, ?ResponseInterface $response = null)
350350
{
351351
$this->response = is_null($response) ? new Response() : $response;
352352
$this->getTokenController()->handleRevokeRequest($request, $this->response);
@@ -408,7 +408,7 @@ public function handleAuthorizeRequest(RequestInterface $request, ResponseInterf
408408
*
409409
* @ingroup oauth2_section_3
410410
*/
411-
public function validateAuthorizeRequest(RequestInterface $request, ResponseInterface $response = null)
411+
public function validateAuthorizeRequest(RequestInterface $request, ?ResponseInterface $response = null)
412412
{
413413
$this->response = is_null($response) ? new Response() : $response;
414414
$value = $this->getAuthorizeController()->validateAuthorizeRequest($request, $this->response);
@@ -422,7 +422,7 @@ public function validateAuthorizeRequest(RequestInterface $request, ResponseInte
422422
* @param string $scope - Scope
423423
* @return mixed
424424
*/
425-
public function verifyResourceRequest(RequestInterface $request, ResponseInterface $response = null, $scope = null)
425+
public function verifyResourceRequest(RequestInterface $request, ?ResponseInterface $response = null, $scope = null)
426426
{
427427
$this->response = is_null($response) ? new Response() : $response;
428428
$value = $this->getResourceController()->verifyResourceRequest($request, $this->response, $scope);
@@ -435,7 +435,7 @@ public function verifyResourceRequest(RequestInterface $request, ResponseInterfa
435435
* @param ResponseInterface $response - Response object
436436
* @return mixed
437437
*/
438-
public function getAccessTokenData(RequestInterface $request, ResponseInterface $response = null)
438+
public function getAccessTokenData(RequestInterface $request, ?ResponseInterface $response = null)
439439
{
440440
$this->response = is_null($response) ? new Response() : $response;
441441
$value = $this->getResourceController()->getAccessTokenData($request, $this->response);

src/OAuth2/Storage/JwtAccessToken.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class JwtAccessToken implements JwtAccessTokenInterface
2121
* is not necessary when using this grant type.
2222
* @param OAuth2\Encryption\EncryptionInterface $encryptionUtil OPTIONAL class to use for "encode" and "decode" functions.
2323
*/
24-
public function __construct(PublicKeyInterface $publicKeyStorage, AccessTokenInterface $tokenStorage = null, EncryptionInterface $encryptionUtil = null)
24+
public function __construct(PublicKeyInterface $publicKeyStorage, ?AccessTokenInterface $tokenStorage = null, ?EncryptionInterface $encryptionUtil = null)
2525
{
2626
$this->publicKeyStorage = $publicKeyStorage;
2727
$this->tokenStorage = $tokenStorage;

0 commit comments

Comments
 (0)