diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index a37a7c8..f460e04 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -32,11 +32,7 @@ jobs: name: PHPStan steps: - uses: actions/checkout@v5 - - name: Use PHP 8.3 - uses: shivammathur/setup-php@v2 - with: - php-version: 8.3 - extensions: curl + - uses: shivammathur/setup-php@v2 - name: Install dependencies run: composer install --no-progress - name: Run PHPStan diff --git a/composer.json b/composer.json old mode 100755 new mode 100644 index a0cc6f0..be43281 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ }, "require-dev": { "geocoder-php/nominatim-provider": "^5.3", - "phpstan/phpstan": "^1.10" + "phpstan/phpstan": "^1.10 || ^2.0" }, "autoload": { "psr-4": { diff --git a/src/BaseTestCase.php b/src/BaseTestCase.php index 9e5d1e0..a74dc89 100644 --- a/src/BaseTestCase.php +++ b/src/BaseTestCase.php @@ -31,7 +31,7 @@ abstract protected function getCacheDir(); /** * Get a real HTTP client. If a cache dir is set to a path it will use cached responses. */ - protected function getHttpClient(string $apiKey = null): ClientInterface + protected function getHttpClient(?string $apiKey = null): ClientInterface { if (null !== $cacheDir = $this->getCacheDir()) { return new CachedResponseClient(new HttplugClient(), $cacheDir, $apiKey); @@ -43,7 +43,7 @@ protected function getHttpClient(string $apiKey = null): ClientInterface /** * Get a mocked HTTP client that never do calls over the internet. Use this is you want to control the response data. */ - protected function getMockedHttpClient(string $body = null, int $statusCode = 200): ClientInterface + protected function getMockedHttpClient(?string $body = null, int $statusCode = 200): ClientInterface { $client = new MockedHttpClient(); $client->addResponse(new Response($statusCode, [], $body)); diff --git a/src/ProviderIntegrationTest.php b/src/ProviderIntegrationTest.php index 94ca1c0..ef85d2a 100644 --- a/src/ProviderIntegrationTest.php +++ b/src/ProviderIntegrationTest.php @@ -213,7 +213,7 @@ public function testGeocodeIpv6(): void * @param ResponseInterface|null $response * @param string $message */ - public function testExceptions($query, string $exceptionClass, ResponseInterface $response = null, string $message = ''): void + public function testExceptions($query, string $exceptionClass, ?ResponseInterface $response = null, string $message = ''): void { if (isset($this->skippedTests[__FUNCTION__])) { $this->markTestSkipped($this->skippedTests[__FUNCTION__]); @@ -311,7 +311,6 @@ private function assertWellFormattedResult(Collection $result): void 'Location::getAdminLevels MUST always return a AdminLevelCollection' ); $arrayData = $location->toArray(); - $this->assertTrue(is_array($arrayData), 'Location::toArray MUST return an array.'); $this->assertNotEmpty($arrayData, 'Location::toArray cannot be empty.'); // Verify coordinates