From 8a29461102fd5088ae8866ecd67216d551d7ca28 Mon Sep 17 00:00:00 2001 From: Lynh Date: Mon, 15 Apr 2024 09:09:36 +0700 Subject: [PATCH] Laravel 11 --- .github/workflows/testing.yml | 8 ++++++-- composer.json | 8 ++++---- phpstan.neon.dist | 2 +- src/Hades.php | 4 ++-- src/Http/Middleware/IdentifyRequest.php | 2 +- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index b870105..8597de8 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -11,16 +11,20 @@ jobs: matrix: # os: [ubuntu-latest, windows-latest] os: [ubuntu-latest] - php: [8.0, 8.1, 8.2] - laravel: [9.*, 10.*] + php: [8.0, 8.1, 8.2, 8.3] + laravel: [9.*, 10.*, 11.*] include: - laravel: 9.* testbench: 7.* - laravel: 10.* testbench: 8.* + - laravel: 11.* + testbench: 9.* exclude: - laravel: 10.* php: 8.0 + - laravel: 11.* + php: 8.0 name: PHP ${{ matrix.php }} / Laravel ${{ matrix.laravel }} - ${{ matrix.os }} diff --git a/composer.json b/composer.json index b7be6b6..435a801 100644 --- a/composer.json +++ b/composer.json @@ -21,14 +21,14 @@ ], "require": { "php": "^8.0", - "illuminate/contracts": "^9.0|^10.0", - "illuminate/config": "^9.0|^10.0", - "illuminate/support": "^9.0|^10.0" + "illuminate/contracts": "^9.0|^10.0|^11.0", + "illuminate/config": "^9.0|^10.0|^11.0", + "illuminate/support": "^9.0|^10.0|^11.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "^3.10", "nunomaduro/larastan": "^2.4", - "orchestra/testbench": "^7.0|^8.0", + "orchestra/testbench": "^7.0|^8.0|^9.0", "phpunit/phpunit": "^9.0|^10.0" }, "autoload": { diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 973cb86..3c4fba0 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -7,6 +7,6 @@ parameters: - src # The level 9 is the highest level - level: 7 + level: 8 checkMissingIterableValueType: false diff --git a/src/Hades.php b/src/Hades.php index 89017d9..0201671 100644 --- a/src/Hades.php +++ b/src/Hades.php @@ -53,7 +53,7 @@ private static function requestIdentifier(): Closure */ public static function identify(Request $request): bool { - return call_user_func(self::requestIdentifier(), $request); + return self::requestIdentifier()($request); } /** @@ -61,7 +61,7 @@ public static function identify(Request $request): bool * * @param \Closure(Request): bool $when */ - public static function forceJsonOutput(Closure $when = null): static + public static function forceJsonOutput(Closure $when = null): self { if ($when) { // Set the callback that will be used to identify the current request. diff --git a/src/Http/Middleware/IdentifyRequest.php b/src/Http/Middleware/IdentifyRequest.php index c17977f..f70bbf1 100644 --- a/src/Http/Middleware/IdentifyRequest.php +++ b/src/Http/Middleware/IdentifyRequest.php @@ -34,6 +34,6 @@ protected function wantsJson(Request $request): bool { // We can't use $request->wantsJson() here because it will cache the // Accept header for subsequent check. - return Str::contains($request->header('Accept'), ['/json', '+json']); + return Str::contains($request->header('Accept') ?? '', ['/json', '+json']); } }