diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 68fd643..5eebafa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,8 +13,8 @@ jobs: strategy: fail-fast: false matrix: - php: [ 8.1, 8.2, 8.3 ] - laravel: [ 10.*, 11.* ] + php: [ 8.1, 8.2, 8.3, 8.4 ] + laravel: [ 10.*, 11.*, 12.* ] stability: [ prefer-stable ] experimental: [ false ] include: @@ -22,9 +22,13 @@ jobs: testbench: 8.* - laravel: 11.* testbench: 9.* + - laravel: 12.* + testbench: 10.* exclude: - php: 8.1 laravel: 11.* + - php: 8.1 + laravel: 12.* name: PHP ${{ matrix.php }} - L${{ matrix.laravel }} @@ -49,11 +53,10 @@ jobs: composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update --dev --ignore-platform-reqs composer update --${{ matrix.stability }} --prefer-dist --no-interaction --ignore-platform-reqs - - name: Setup problem matchers for PHP - run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" - - - name: Setup problem matchers for PHPUnit - run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + - name: Setup problem matchers + run: | + echo "::add-matcher::${{ runner.tool_cache }}/php.json" + echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" - name: Execute tests (Unit and Feature) run: vendor/bin/phpunit diff --git a/composer.json b/composer.json index fcea659..b8e0632 100644 --- a/composer.json +++ b/composer.json @@ -33,13 +33,13 @@ "php": ">=8.1", "jumbojett/openid-connect-php": "^1.0.2", "guzzlehttp/guzzle": "^7.5", - "illuminate/contracts": "^10.0||^11.0", + "illuminate/contracts": "^10.0||^11.0||^12.0", "web-token/jwt-library": "^3.4" }, "require-dev": { - "orchestra/testbench": "^8.0||^9.0", - "phpunit/phpunit": "^10.0", - "vimeo/psalm": "^5.8", + "orchestra/testbench": "^8.0||^9.0||^10.0", + "phpunit/phpunit": "^10.0||^11.0||^12.0", + "vimeo/psalm": "^5.8||^6.0", "phpstan/phpstan": "^1.10", "squizlabs/php_codesniffer": "^3.8", "slevomat/coding-standard": "^8.14", diff --git a/src/Http/Responses/LoginResponseHandler.php b/src/Http/Responses/LoginResponseHandler.php index 2bedbfa..83a9f90 100644 --- a/src/Http/Responses/LoginResponseHandler.php +++ b/src/Http/Responses/LoginResponseHandler.php @@ -9,6 +9,7 @@ class LoginResponseHandler implements LoginResponseHandlerInterface { + #[\Override] public function handleLoginResponse(object $userInfo): Response { return new JsonResponse([ diff --git a/src/OpenIDConnectClient.php b/src/OpenIDConnectClient.php index 286526b..2e79177 100644 --- a/src/OpenIDConnectClient.php +++ b/src/OpenIDConnectClient.php @@ -40,11 +40,13 @@ public function __construct( $this->openIDConfiguration = $openIDConfiguration; } + #[\Override] protected function startSession(): void { // Laravel magic in the background :) } + #[\Override] protected function commitSession(): void { Session::save(); @@ -53,6 +55,7 @@ protected function commitSession(): void /** * @param string $key */ + #[\Override] protected function getSessionKey($key): mixed { if (!Session::has($key)) { @@ -66,6 +69,7 @@ protected function getSessionKey($key): mixed * @param string $key * @param mixed $value mixed */ + #[\Override] protected function setSessionKey($key, $value): void { Session::put($key, $value); @@ -74,6 +78,7 @@ protected function setSessionKey($key, $value): void /** * @param string $key */ + #[\Override] protected function unsetSessionKey($key): void { Session::remove($key); @@ -84,6 +89,7 @@ protected function unsetSessionKey($key): void * @return string the JWT payload * @throws OpenIDConnectClientException */ + #[\Override] protected function handleJweResponse($jwe): string { if ($this->jweDecrypter === null) { @@ -102,6 +108,7 @@ protected function handleJweResponse($jwe): string * @throws OpenIDConnectClientException * @return string|string[]|bool */ + #[\Override] protected function getWellKnownConfigValue($param, $default = null): string|array|bool { if ($this->openIDConfiguration === null) { @@ -137,6 +144,7 @@ public function setLoginHint(?string $loginHint = null): void * @return void * @throws OpenIDConnectClientException */ + #[\Override] public function redirect($url): void { throw new HttpResponseException(new RedirectResponse($url)); @@ -172,7 +180,8 @@ protected function getAuthorizationEndpoint(): string * @return string * @throws OpenIDConnectClientException */ - protected function fetchURL(string $url, string $post_body = null, array $headers = []): string + #[\Override] + protected function fetchURL(string $url, ?string $post_body = null, array $headers = []): string { $pendingRequest = Http::withUserAgent($this->getUserAgent()) ->timeout($this->timeOut) @@ -211,6 +220,7 @@ protected function fetchURL(string $url, string $post_body = null, array $header * * @return int */ + #[\Override] public function getResponseCode(): int { return $this->responseCode ?? 0; @@ -221,6 +231,7 @@ public function getResponseCode(): int * * @return string|null */ + #[\Override] public function getResponseContentType(): ?string { return $this->internalResponseContentType; diff --git a/src/OpenIDConnectServiceProvider.php b/src/OpenIDConnectServiceProvider.php index 733682c..14b2b76 100644 --- a/src/OpenIDConnectServiceProvider.php +++ b/src/OpenIDConnectServiceProvider.php @@ -25,6 +25,7 @@ class OpenIDConnectServiceProvider extends ServiceProvider { + #[\Override] public function register(): void { $this->mergeConfigFrom(__DIR__ . '/../config/oidc.php', 'oidc'); diff --git a/src/Services/ExceptionHandler.php b/src/Services/ExceptionHandler.php index 147f747..bf96b64 100644 --- a/src/Services/ExceptionHandler.php +++ b/src/Services/ExceptionHandler.php @@ -17,6 +17,7 @@ public function __construct( ) { } + #[\Override] public function handleExceptionWhileAuthenticate(OpenIDConnectClientException $exception): Response { if (str_starts_with($exception->getMessage(), 'Error: ')) { @@ -38,6 +39,7 @@ public function handleExceptionWhileAuthenticate(OpenIDConnectClientException $e * @param OpenIDConnectClientException $exception * @return Response */ + #[\Override] public function handleExceptionWhileRequestUserInfo(OpenIDConnectClientException $exception): Response { $this->logger?->error('OIDC Exception occurred while requesting user info', [ @@ -47,6 +49,7 @@ public function handleExceptionWhileRequestUserInfo(OpenIDConnectClientException return $this->defaultResponse($exception); } + #[\Override] public function handleException(Exception $exception): Response { $this->logger?->error('OIDC Generic exception occurred', [ diff --git a/src/Services/JWE/JweDecryptService.php b/src/Services/JWE/JweDecryptService.php index cb1fc69..b91b88b 100644 --- a/src/Services/JWE/JweDecryptService.php +++ b/src/Services/JWE/JweDecryptService.php @@ -35,6 +35,7 @@ public function __construct( /** * @throws JweDecryptException */ + #[\Override] public function decrypt(string $jweString): string { $jwe = $this->serializerManager->unserialize($jweString);