Skip to content

Commit 1a506fc

Browse files
authored
feat(CDP-1451): ErrorHandler::handleError() - $uri & request explicit nullable type (#30)
1 parent cbe61fc commit 1a506fc

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/ErrorHandler.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
use Buzz\Exception\ClientException;
66
use Jobcloud\Kafka\SchemaRegistryClient\Exception\BackendDatastoreException;
7-
use Jobcloud\Kafka\SchemaRegistryClient\Exception\ImportException;
87
use Jobcloud\Kafka\SchemaRegistryClient\Exception\CompatibilityException;
8+
use Jobcloud\Kafka\SchemaRegistryClient\Exception\ImportException;
99
use Jobcloud\Kafka\SchemaRegistryClient\Exception\IncompatibileAvroSchemaException;
1010
use Jobcloud\Kafka\SchemaRegistryClient\Exception\InvalidAvroSchemaException;
1111
use Jobcloud\Kafka\SchemaRegistryClient\Exception\InvalidVersionException;
@@ -18,10 +18,10 @@
1818
use Jobcloud\Kafka\SchemaRegistryClient\Exception\UnauthorizedException;
1919
use Jobcloud\Kafka\SchemaRegistryClient\Exception\UnprocessableEntityException;
2020
use Jobcloud\Kafka\SchemaRegistryClient\Exception\VersionNotFoundException;
21+
use JsonException;
2122
use Psr\Http\Client\ClientExceptionInterface;
2223
use Psr\Http\Message\RequestInterface;
2324
use Psr\Http\Message\ResponseInterface;
24-
use JsonException;
2525

2626
class ErrorHandler implements ErrorHandlerInterface
2727
{
@@ -45,8 +45,11 @@ class ErrorHandler implements ErrorHandlerInterface
4545
* @throws ClientExceptionInterface
4646
* @throws SchemaRegistryExceptionInterface
4747
*/
48-
public function handleError(ResponseInterface $response, string $uri = null, RequestInterface $request = null): void
49-
{
48+
public function handleError(
49+
ResponseInterface $response,
50+
?string $uri = null,
51+
?RequestInterface $request = null
52+
): void {
5053
$responseContent = json_decode($response->getBody(), true, 512, JSON_THROW_ON_ERROR);
5154

5255
if (false === isset($responseContent['error_code'])) {

src/ErrorHandlerInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ interface ErrorHandlerInterface
1717
*/
1818
public function handleError(
1919
ResponseInterface $response,
20-
string $uri = null,
21-
RequestInterface $request = null
20+
?string $uri = null,
21+
?RequestInterface $request = null
2222
): void;
2323
}

0 commit comments

Comments
 (0)