diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 04739a9..0e79ec3 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -14,15 +14,18 @@ jobs: fail-fast: false matrix: php_version: - - '7.4' - '8.0' + - '8.1' + - '8.2' dependencies: - 'default' include: - - php_version: '7.4' - dependencies: 'lowest' - php_version: '8.0' dependencies: 'lowest' + - php_version: '8.1' + dependencies: 'lowest' + - php_version: '8.2' + dependencies: 'lowest' steps: - name: Setup PHP uses: shivammathur/setup-php@v2 diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e1c490..69c1200 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ ### Unreleased +### v2.1.0 (2022-10-25) + +* Drop support for PHP 7.4 +* Support PHP 8.1 & 8.2 + ### v2.0.0 (2021-10-12) * Drop support for php 7.2 diff --git a/composer.json b/composer.json index 55bc3ec..582334e 100644 --- a/composer.json +++ b/composer.json @@ -11,11 +11,11 @@ } ], "require": { - "guzzlehttp/guzzle": "^6.2 || ^7.0", - "php": "^7.4 || ~8.0.0" + "guzzlehttp/guzzle": "^7.0", + "php": "~8.0.0 || ~8.1.0 || ~8.2.0" }, "require-dev": { - "phpunit/phpunit": "^9.5", + "phpunit/phpunit": "^9.5.5", "johnkary/phpunit-speedtrap": "^3.3" }, "support": { diff --git a/phpunit.xml b/phpunit.xml index b6ebd69..eb50be6 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -6,6 +6,7 @@ convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" + convertDeprecationsToExceptions="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"> diff --git a/src/EventSearchIterator.php b/src/EventSearchIterator.php index 74f3207..0cb44ac 100644 --- a/src/EventSearchIterator.php +++ b/src/EventSearchIterator.php @@ -18,7 +18,6 @@ class EventSearchIterator implements IteratorAggregate { - protected FestivalsApiClient $client; protected EventSearchResult $last_result; @@ -28,9 +27,8 @@ class EventSearchIterator implements IteratorAggregate protected int $request_count = 0; - public function __construct(FestivalsApiClient $client) + public function __construct(protected FestivalsApiClient $client) { - $this->client = $client; } /** diff --git a/src/FestivalsApiClient.php b/src/FestivalsApiClient.php index e3adabd..98e4c9d 100644 --- a/src/FestivalsApiClient.php +++ b/src/FestivalsApiClient.php @@ -26,13 +26,10 @@ class FestivalsApiClient protected string $base_url; - protected Client $guzzle; - protected string $secret; - public function __construct(Client $guzzle, string $base_url = self::BASE_URL) + public function __construct(protected Client $guzzle, string $base_url = self::BASE_URL) { - $this->guzzle = $guzzle; $this->setBaseUrl($base_url); } @@ -90,9 +87,8 @@ public function setCredentials(string $access_key, string $secret): void protected function createRequest(string $url): Request { $full_url = $this->base_url.$this->getSignedUrl($url); - $request = new Request('GET', $full_url); - return $request; + return new Request('GET', $full_url); } protected function decodeJsonResponse(ResponseInterface $response): array @@ -114,7 +110,7 @@ protected function getSignature(string $data): string */ protected function getSignedUrl(string $url): string { - if (strpos($url, '?') !== FALSE) { + if (str_contains($url, '?')) { $url .= '&key='.$this->access_key; } else { $url .= '?key='.$this->access_key; diff --git a/src/FestivalsApiClientException.php b/src/FestivalsApiClientException.php index d57cd9d..01d7d6c 100644 --- a/src/FestivalsApiClientException.php +++ b/src/FestivalsApiClientException.php @@ -13,17 +13,13 @@ class FestivalsApiClientException extends RuntimeException { - - protected ?string $url; - public function __construct( string $message, - ?int $code = NULL, - ?string $url = NULL, + int $code = 0, + protected ?string $url = NULL, ?Exception $previous_exception = NULL ) { parent::__construct($message, $code, $previous_exception); - $this->url = $url; } public static function invalidJsonResponse(int $code, ?Exception $previous_exception = NULL): FestivalsApiClientException