diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8ad070b..fa89286 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php-versions: ['8.2', '8.3'] + php-versions: ['8.2', '8.3', '8.4'] steps: # Checkout the repository @@ -30,7 +30,7 @@ jobs: - run: php --version # Print Composer version - - run: composer --version + - run: composer --version # Validate composer.json syntax - name: Validate composer.json syntax @@ -46,4 +46,4 @@ jobs: # Run PHPUnit tests - name: Run PHPUnit run: vendor/bin/phpunit - --no-progress \ No newline at end of file + --no-progress diff --git a/composer.json b/composer.json index 8b26f18..60b6721 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ "php-http/httplug": "^2.4", "php-http/client-common": "^2.7", "psr/http-message": "^2.0", - "jumbojett/openid-connect-php": "^1.0", + "jumbojett/openid-connect-php": "dev-master", "symfony/serializer": "^7.2", "symfony/property-access": "^7.2", "json-mapper/json-mapper": "^2.22", @@ -36,13 +36,14 @@ }, "require-dev": { "phpunit/phpunit": "^11.3", - "phpstan/phpstan": "^1.12", + "phpstan/phpstan": "^2.1", "mockery/mockery": "^1.6", "squizlabs/php_codesniffer": "^3.10", "phpcompatibility/php-compatibility": "^9.3", "symfony/var-dumper": "^7.1", "guzzlehttp/guzzle": "^7.9", - "vlucas/phpdotenv": "^5.6" + "vlucas/phpdotenv": "^5.6", + "rector/rector": "^2.0" }, "scripts": { "analyze": "vendor/bin/phpstan", diff --git a/rector.php b/rector.php new file mode 100644 index 0000000..5daf004 --- /dev/null +++ b/rector.php @@ -0,0 +1,8 @@ +withPaths([__DIR__ . '/src', __DIR__ . '/tests', __DIR__ . '/examples']) + ->withPhpVersion(Rector\ValueObject\PhpVersion::PHP_84) + ->withRules([ + Rector\Php84\Rector\Param\ExplicitNullableParamTypeRector::class, + ]); diff --git a/src/Apis/AbstractCollection.php b/src/Apis/AbstractCollection.php index 3e26ab4..acbfba1 100644 --- a/src/Apis/AbstractCollection.php +++ b/src/Apis/AbstractCollection.php @@ -26,11 +26,9 @@ public function __construct(AbstractResponse ...$items) * @param AbstractResponse $item The item * @return void */ - public function add(mixed $item): void + public function add(AbstractResponse $item): void { - if ($item instanceof AbstractResponse) { - $this->items[] = $item; - } + $this->items[] = $item; } /** diff --git a/src/EnvironmentManager.php b/src/EnvironmentManager.php index 4b47316..798a8a8 100644 --- a/src/EnvironmentManager.php +++ b/src/EnvironmentManager.php @@ -67,6 +67,6 @@ public function getIdpUrl(): string private function validateEnvironment(?string $environment): bool { - return isset($environment) && $environment !== null && in_array($environment, ApiEnvironment::asArray()); + return isset($environment) && in_array($environment, ApiEnvironment::asArray()); } } diff --git a/src/HttpClient/Builder.php b/src/HttpClient/Builder.php index 6657e13..33317d9 100644 --- a/src/HttpClient/Builder.php +++ b/src/HttpClient/Builder.php @@ -33,10 +33,10 @@ class Builder private array $plugins = []; public function __construct( - ClientInterface $httpClient = null, - RequestFactoryInterface $requestFactory = null, - StreamFactoryInterface $streamFactory = null, - UriFactoryInterface $uriFactory = null + ?ClientInterface $httpClient = null, + ?RequestFactoryInterface $requestFactory = null, + ?StreamFactoryInterface $streamFactory = null, + ?UriFactoryInterface $uriFactory = null ) { $this->httpClient = $httpClient ?? Psr18ClientDiscovery::find(); $this->requestFactory = $requestFactory ?? Psr17FactoryDiscovery::findRequestFactory(); diff --git a/tests/Endpoints/BaseEndpointTestCase.php b/tests/Endpoints/BaseEndpointTestCase.php index b0dc8da..96ccdac 100644 --- a/tests/Endpoints/BaseEndpointTestCase.php +++ b/tests/Endpoints/BaseEndpointTestCase.php @@ -14,10 +14,10 @@ class BaseEndpointTestCase extends TestCase { private DataProviderInterface $provider; - public function __construct(string $name) + protected function setUp(): void { + parent::setUp(); $this->initDataProvider(); - parent::__construct($name); } private function initDataProvider(): void diff --git a/tests/Endpoints/DataProvider.php b/tests/Endpoints/DataProvider.php index d56054b..5c37b86 100644 --- a/tests/Endpoints/DataProvider.php +++ b/tests/Endpoints/DataProvider.php @@ -51,7 +51,7 @@ public function getData(mixed $param = null): array /** * @param array|null $requests */ - public function createClientHandler(?array $requests = [], ?MockHandler &$mock = null): SeravoApiClient + public function createClientHandler(?array $requests = [], ?MockHandler $mock = null): SeravoApiClient { $mock = new MockHandler($requests); return new SeravoApiClient(