Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.4.x] Fix PHP 8.4 deprecation notices #1466

Merged
merged 4 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
tests:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04

strategy:
fail-fast: false
Expand All @@ -20,14 +20,18 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip
coverage: pcov

- name: Remove Security Advisories on obsolete PHP versions
run: composer remove "roave/security-advisories" --dev --no-update
if: matrix.php <= 7.4

- name: Install dependencies
run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress
Expand Down
1 change: 1 addition & 0 deletions .styleci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ enabled:
- no_unreachable_default_argument_value
- no_unused_imports
- no_whitespace_before_comma_in_array
- nullable_type_declarations
- ordered_imports
- phpdoc_align
- phpdoc_indent
Expand Down
4 changes: 2 additions & 2 deletions src/AuthorizationServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function __construct(
ScopeRepositoryInterface $scopeRepository,
$privateKey,
$encryptionKey,
ResponseTypeInterface $responseType = null
?ResponseTypeInterface $responseType = null
) {
$this->clientRepository = $clientRepository;
$this->accessTokenRepository = $accessTokenRepository;
Expand Down Expand Up @@ -128,7 +128,7 @@ public function __construct(
* @param GrantTypeInterface $grantType
* @param null|DateInterval $accessTokenTTL
*/
public function enableGrantType(GrantTypeInterface $grantType, DateInterval $accessTokenTTL = null)
public function enableGrantType(GrantTypeInterface $grantType, ?DateInterval $accessTokenTTL = null)
{
if ($accessTokenTTL === null) {
$accessTokenTTL = new DateInterval('PT1H');
Expand Down
2 changes: 1 addition & 1 deletion src/AuthorizationValidators/BearerTokenValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class BearerTokenValidator implements AuthorizationValidatorInterface
* @param AccessTokenRepositoryInterface $accessTokenRepository
* @param \DateInterval|null $jwtValidAtDateLeeway
*/
public function __construct(AccessTokenRepositoryInterface $accessTokenRepository, \DateInterval $jwtValidAtDateLeeway = null)
public function __construct(AccessTokenRepositoryInterface $accessTokenRepository, ?\DateInterval $jwtValidAtDateLeeway = null)
{
$this->accessTokenRepository = $accessTokenRepository;
$this->jwtValidAtDateLeeway = $jwtValidAtDateLeeway;
Expand Down
12 changes: 6 additions & 6 deletions src/Exception/OAuthServerException.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ class OAuthServerException extends Exception
* @param null|string $redirectUri A HTTP URI to redirect the user back to
* @param Throwable $previous Previous exception
*/
public function __construct($message, $code, $errorType, $httpStatusCode = 400, $hint = null, $redirectUri = null, Throwable $previous = null)
public function __construct($message, $code, $errorType, $httpStatusCode = 400, $hint = null, $redirectUri = null, ?Throwable $previous = null)
{
parent::__construct($message, $code, $previous);
$this->httpStatusCode = $httpStatusCode;
$this->errorType = $errorType;
$this->hint = $hint;
$this->redirectUri = $redirectUri;
$this->payload = [
'error' => $errorType,
'error' => $errorType,
'error_description' => $message,
];
if ($hint !== null) {
Expand Down Expand Up @@ -133,7 +133,7 @@ public static function unsupportedGrantType()
*
* @return static
*/
public static function invalidRequest($parameter, $hint = null, Throwable $previous = null)
public static function invalidRequest($parameter, $hint = null, ?Throwable $previous = null)
{
$errorMessage = 'The request is missing a required parameter, includes an invalid parameter value, ' .
'includes a parameter more than once, or is otherwise malformed.';
Expand Down Expand Up @@ -202,7 +202,7 @@ public static function invalidCredentials()
*
* @codeCoverageIgnore
*/
public static function serverError($hint, Throwable $previous = null)
public static function serverError($hint, ?Throwable $previous = null)
{
return new static(
'The authorization server encountered an unexpected condition which prevented it from fulfilling'
Expand All @@ -224,7 +224,7 @@ public static function serverError($hint, Throwable $previous = null)
*
* @return static
*/
public static function invalidRefreshToken($hint = null, Throwable $previous = null)
public static function invalidRefreshToken($hint = null, ?Throwable $previous = null)
{
return new static('The refresh token is invalid.', 8, 'invalid_request', 401, $hint, null, $previous);
}
Expand All @@ -238,7 +238,7 @@ public static function invalidRefreshToken($hint = null, Throwable $previous = n
*
* @return static
*/
public static function accessDenied($hint = null, $redirectUri = null, Throwable $previous = null)
public static function accessDenied($hint = null, $redirectUri = null, ?Throwable $previous = null)
{
return new static(
'The resource owner or authorization server denied the request.',
Expand Down
2 changes: 1 addition & 1 deletion src/ResourceServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class ResourceServer
public function __construct(
AccessTokenRepositoryInterface $accessTokenRepository,
$publicKey,
AuthorizationValidatorInterface $authorizationValidator = null
?AuthorizationValidatorInterface $authorizationValidator = null
) {
$this->accessTokenRepository = $accessTokenRepository;

Expand Down
2 changes: 1 addition & 1 deletion tests/Stubs/GrantType.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ final class GrantType implements GrantTypeInterface
{
private $emitter;

public function setEmitter(EmitterInterface $emitter = null)
public function setEmitter(?EmitterInterface $emitter = null)
{
$this->emitter = $emitter;

Expand Down
Loading