Skip to content

Commit 4b5b788

Browse files
authored
Update flix-tech/avro-php dependency (#36)
Co-authored-by: @nick-zh Co-authored-by: @tPl0ch
1 parent ec106af commit 4b5b788

File tree

7 files changed

+40
-7
lines changed

7 files changed

+40
-7
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ composer-update:
3131
PHP_VERSION=$(PHP_VERSION) $(PHP) $(COMPOSER) update --no-interaction --no-progress --no-suggest --no-scripts
3232

3333
phpstan:
34-
PHP_VERSION=$(PHP_VERSION) $(PHP) vendor/bin/phpstan.phar analyse -l 7 src
34+
PHP_VERSION=$(PHP_VERSION) $(PHP) vendor/bin/phpstan.phar analyse
3535

3636
cs-fixer:
3737
PHP_VERSION=$(PHP_VERSION) $(PHP) bin/php-cs-fixer.phar fix --config=.php_cs.dist -v --dry-run \

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ compliant requests that can be used as well as high level abstractions to ease d
3636
| **`php`** | ~7.2 | Anything lower has reached EOL |
3737
| **`guzzlephp/guzzle`** | ~6.3 | Using `Request` to build PSR-7 `RequestInterface` |
3838
| **`beberlei/assert`** | ~2.7\|~3.0 | The de-facto standard assertions library for PHP |
39-
| **`flix-tech/avro-php`** | ^3.0 | Maintained fork of the only Avro PHP implementation: `rg/avro-php` |
39+
| **`flix-tech/avro-php`** | ^4.0 | Maintained fork of the only Avro PHP implementation: `rg/avro-php` |
4040

4141
### Optional dependencies
4242

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
"ext-json": "*",
1717
"guzzlehttp/guzzle": "~6.3",
1818
"beberlei/assert": "~2.7|~3.0",
19-
"flix-tech/avro-php": "^3.0"
19+
"flix-tech/avro-php": "^3.0|^4.0"
2020
},
2121
"require-dev": {
2222
"phpunit/phpunit": "~7.0",
23-
"phpstan/phpstan-shim": "~0.8",
23+
"phpstan/phpstan": "^0.12",
2424
"raphhh/trex-reflection": "~1.0",
2525
"doctrine/cache": "~1.3"
2626
},

phpstan.neon

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
parameters:
2+
level: 8
3+
paths: [ src ]

src/Exception/ExceptionMap.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ private function guardAgainstMissingResponse(RequestException $exception): Respo
6161
return $response;
6262
}
6363

64+
/**
65+
* @param ResponseInterface $response
66+
* @return array<mixed, mixed>
67+
*/
6468
private function guardAgainstMissingErrorCode(ResponseInterface $response): array
6569
{
6670
try {
@@ -88,7 +92,12 @@ private function guardAgainstMissingErrorCode(ResponseInterface $response): arra
8892
}
8993
}
9094

91-
private function mapErrorCodeToException($errorCode, $errorMessage)
95+
/**
96+
* @param int $errorCode
97+
* @param string $errorMessage
98+
* @return SchemaRegistryException
99+
*/
100+
private function mapErrorCodeToException($errorCode, $errorMessage): SchemaRegistryException
92101
{
93102
switch ($errorCode) {
94103
case IncompatibleAvroSchemaException::errorCode():

src/Registry/PromisingRegistry.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,10 @@ private function makeRequest(RequestInterface $request, callable $onFulfilled, c
163163
->then($onFulfilled, $this->rejectedCallback);
164164
}
165165

166+
/**
167+
* @param ResponseInterface $response
168+
* @return array<mixed, mixed>
169+
*/
166170
private function getJsonFromResponseBody(ResponseInterface $response): array
167171
{
168172
$body = (string) $response->getBody();

src/Requests/Functions.php

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@ function changeSubjectCompatibilityLevelRequest(string $subjectName, string $lev
128128
);
129129
}
130130

131+
/**
132+
* @param int|string $versionId
133+
* @return string
134+
*/
131135
function validateVersionId($versionId): string
132136
{
133137
if (VERSION_LATEST !== $versionId) {
@@ -182,6 +186,10 @@ function prepareCompatibilityLevelForTransport(string $compatibilityLevel): stri
182186
return \GuzzleHttp\json_encode(['compatibility' => $compatibilityLevel]);
183187
}
184188

189+
/**
190+
* @param int|string $schemaId
191+
* @return string
192+
*/
185193
function validateSchemaId($schemaId): string
186194
{
187195
Assert::that($schemaId)
@@ -191,7 +199,11 @@ function validateSchemaId($schemaId): string
191199
return (string) $schemaId;
192200
}
193201

194-
function deleteSubjectRequest(string $subjectName)
202+
/**
203+
* @param string $subjectName
204+
* @return RequestInterface
205+
*/
206+
function deleteSubjectRequest(string $subjectName): RequestInterface
195207
{
196208
return new Request(
197209
'DELETE',
@@ -200,7 +212,12 @@ function deleteSubjectRequest(string $subjectName)
200212
);
201213
}
202214

203-
function deleteSubjectVersionRequest(string $subjectName, string $versionId)
215+
/**
216+
* @param string $subjectName
217+
* @param string $versionId
218+
* @return RequestInterface
219+
*/
220+
function deleteSubjectVersionRequest(string $subjectName, string $versionId): RequestInterface
204221
{
205222
return new Request(
206223
'DELETE',

0 commit comments

Comments
 (0)