diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index acc1bc6..a23fbda 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,7 +36,7 @@ jobs: strategy: fail-fast: false matrix: - php-version: ["8.2", "8.3"] + php-version: ["8.2", "8.3", "8.4", "8.5"] composer-flags: [""] name: [""] include: diff --git a/composer.json b/composer.json index bfe8495..fa05d89 100644 --- a/composer.json +++ b/composer.json @@ -13,10 +13,10 @@ "require": { "php": ">=8.1", "psr/log": "^1|^2|^3", - "symfony/http-client": "^5.4|^6.4|^7.0" + "symfony/http-client": "^5.4|^6.4|^7.0|^8.0" }, "require-dev": { - "symfony/phpunit-bridge": "^6.0|^7.0" + "symfony/phpunit-bridge": "^6.0|^7.0|^8.0" }, "autoload": { "psr-4": { diff --git a/src/Client.php b/src/Client.php index e10d1d5..739cb86 100644 --- a/src/Client.php +++ b/src/Client.php @@ -68,23 +68,23 @@ private function doRequest(string $method, string $url, array $options): ConsulR $options['body'] = json_encode($options['body'], \JSON_THROW_ON_ERROR); } - $this->logger->info(sprintf('%s "%s"', $method, $url)); - $this->logger->debug(sprintf('Requesting %s %s', $method, $url), ['options' => $options]); + $this->logger->info(\sprintf('%s "%s"', $method, $url)); + $this->logger->debug(\sprintf('Requesting %s %s', $method, $url), ['options' => $options]); try { $response = $this->client->request($method, $url, $options); } catch (TransportExceptionInterface $e) { - $message = sprintf('Something went wrong when calling consul (%s).', $e->getMessage()); + $message = \sprintf('Something went wrong when calling consul (%s).', $e->getMessage()); $this->logger->error($message); throw new ServerException($message); } - $this->logger->debug(sprintf("Response:\n%s", $this->formatResponse($response))); + $this->logger->debug(\sprintf("Response:\n%s", $this->formatResponse($response))); if (400 <= $response->getStatusCode()) { - $message = sprintf('Something went wrong when calling consul (%s).', $response->getStatusCode()); + $message = \sprintf('Something went wrong when calling consul (%s).', $response->getStatusCode()); $this->logger->error($message); @@ -105,10 +105,10 @@ private function formatResponse(ResponseInterface $response): string foreach ($response->getHeaders(false) as $key => $values) { foreach ($values as $value) { - $headers[] = sprintf('%s: %s', $key, $value); + $headers[] = \sprintf('%s: %s', $key, $value); } } - return sprintf("%s\n\n%s", implode("\n", $headers), $response->getContent(false)); + return \sprintf("%s\n\n%s", implode("\n", $headers), $response->getContent(false)); } } diff --git a/tests/DsnResolverTest.php b/tests/DsnResolverTest.php index a3e9181..69c342e 100644 --- a/tests/DsnResolverTest.php +++ b/tests/DsnResolverTest.php @@ -7,16 +7,6 @@ class DsnResolverTest extends TestCase { - public function provideResolveTest(): iterable - { - yield ['http://127.0.0.1:5000', 'http://127.0.0.1:5000']; - yield ['https://127.0.0.1:5000', 'https://127.0.0.1:5000']; - yield ['https://foo:5000', 'https://foo:5000']; - yield ['http://127.0.0.1:5000', '127.0.0.1:5000']; - yield ['http://127.0.0.1:5000', '127.0.0.1:5000']; - yield ['http://127.0.0.1:8500', null]; - } - /** @dataProvider provideResolveTest */ public function testResolve(string $expected, ?string $dsn) { @@ -32,4 +22,14 @@ public function testResolve(string $expected, ?string $dsn) } } } + + public function provideResolveTest(): iterable + { + yield ['http://127.0.0.1:5000', 'http://127.0.0.1:5000']; + yield ['https://127.0.0.1:5000', 'https://127.0.0.1:5000']; + yield ['https://foo:5000', 'https://foo:5000']; + yield ['http://127.0.0.1:5000', '127.0.0.1:5000']; + yield ['http://127.0.0.1:5000', '127.0.0.1:5000']; + yield ['http://127.0.0.1:8500', null]; + } }