From b06a413cb18d07123ced88ba8caa432d40e3bb8c Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Tue, 14 Jan 2025 01:40:20 +0800 Subject: [PATCH] [12.x] Supports PHP 8.4 (#1799) * [12.x] Supports PHP 8.4 * wip Signed-off-by: Mior Muhammad Zaki * Update tests.yml * wip Signed-off-by: Mior Muhammad Zaki * Update tests.yml --------- Signed-off-by: Mior Muhammad Zaki --- .github/workflows/tests.yml | 24 +++++++++++---------- .styleci.yml | 2 ++ src/Passport.php | 6 +++--- tests/Feature/AccessTokenControllerTest.php | 2 +- 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7ca8da38a..0af74d7f7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -16,17 +16,20 @@ jobs: strategy: fail-fast: true matrix: - php: ['8.0', 8.1, 8.2, 8.3] - laravel: [9, 10, 11] - exclude: - - php: '8.0' - laravel: 10 + php: [8.1, 8.2, 8.3, 8.4] + laravel: [10, 11] + include: + - php: 8.2 + laravel: 9 + - php: 8.1 + laravel: 9 - php: '8.0' - laravel: 11 + laravel: 9 + exclude: - php: 8.1 laravel: 11 - - php: 8.3 - laravel: 9 + - php: 8.4 + laravel: 10 name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }} @@ -45,8 +48,7 @@ jobs: - name: Install dependencies run: | - composer require "illuminate/contracts=^${{ matrix.laravel }}" --no-update - composer update --prefer-dist --no-interaction --no-progress + composer update --prefer-dist --no-interaction --no-progress --with="illuminate/contracts=^${{ matrix.laravel }}" - name: Execute tests - run: vendor/bin/phpunit + run: vendor/bin/phpunit ${{ matrix.laravel >= 10 && '--display-deprecations' || '' }} diff --git a/.styleci.yml b/.styleci.yml index 215fbcfe3..928888750 100644 --- a/.styleci.yml +++ b/.styleci.yml @@ -1,4 +1,6 @@ php: preset: laravel + enabled: + - nullable_type_declarations js: true css: true diff --git a/src/Passport.php b/src/Passport.php index ccfe6455d..9cffe810a 100644 --- a/src/Passport.php +++ b/src/Passport.php @@ -291,7 +291,7 @@ public static function tokensCan(array $scopes) * @param \DateTimeInterface|\DateInterval|null $date * @return \DateInterval|static */ - public static function tokensExpireIn(DateTimeInterface|DateInterval $date = null) + public static function tokensExpireIn(DateTimeInterface|DateInterval|null $date = null) { if (is_null($date)) { return static::$tokensExpireIn ?? new DateInterval('P1Y'); @@ -310,7 +310,7 @@ public static function tokensExpireIn(DateTimeInterface|DateInterval $date = nul * @param \DateTimeInterface|\DateInterval|null $date * @return \DateInterval|static */ - public static function refreshTokensExpireIn(DateTimeInterface|DateInterval $date = null) + public static function refreshTokensExpireIn(DateTimeInterface|DateInterval|null $date = null) { if (is_null($date)) { return static::$refreshTokensExpireIn ?? new DateInterval('P1Y'); @@ -329,7 +329,7 @@ public static function refreshTokensExpireIn(DateTimeInterface|DateInterval $dat * @param \DateTimeInterface|\DateInterval|null $date * @return \DateInterval|static */ - public static function personalAccessTokensExpireIn(DateTimeInterface|DateInterval $date = null) + public static function personalAccessTokensExpireIn(DateTimeInterface|DateInterval|null $date = null) { if (is_null($date)) { return static::$personalAccessTokensExpireIn ?? new DateInterval('P1Y'); diff --git a/tests/Feature/AccessTokenControllerTest.php b/tests/Feature/AccessTokenControllerTest.php index 39d763983..41375e750 100644 --- a/tests/Feature/AccessTokenControllerTest.php +++ b/tests/Feature/AccessTokenControllerTest.php @@ -292,7 +292,7 @@ public function __construct($idToken) } /** - * @inheritdoc + * {@inheritdoc} */ protected function getExtraParams(\League\OAuth2\Server\Entities\AccessTokenEntityInterface $accessToken) {