Skip to content

Commit cb21f01

Browse files
authored
[CI] Upgrade tested versions in CI and local (#43)
1 parent 02f0db9 commit cb21f01

27 files changed

+485
-582
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,5 @@ variables.mk
1717
/build/
1818
ocular.phar
1919
php-cs-fixer.phar
20+
21+
.phpunit.result.cache

.travis.yml

Lines changed: 55 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ services:
66
- docker
77

88
php:
9-
- '7.2'
109
- '7.3'
10+
- '7.4'
1111

1212
env:
1313
global:
@@ -32,44 +32,89 @@ script:
3232
jobs:
3333
include:
3434
- stage: coverage
35-
php: '7.2'
35+
php: '7.4'
3636
env:
3737
- DEPENDENCIES="stable"
3838
script:
3939
- PHP=php make coverage
4040
- stage: integration
41-
php: '7.2'
41+
php: '7.4'
4242
env:
4343
- DEPENDENCIES="stable"
4444
- INTEGRATION_TEST="enabled"
45-
- CONFLUENT_VERSION=3.3.3
45+
- CONFLUENT_VERSION=4.0.3
4646
script:
4747
- make platform
4848
- PHP=php make phpunit-integration
4949
- stage: integration
50-
php: '7.2'
50+
php: '7.4'
5151
env:
5252
- DEPENDENCIES="stable"
5353
- INTEGRATION_TEST="enabled"
54-
- CONFLUENT_VERSION=4.1.3
54+
- CONFLUENT_VERSION=4.1.4
5555
script:
5656
- make platform
5757
- PHP=php make phpunit-integration
5858
- stage: integration
59-
php: '7.2'
59+
php: '7.4'
60+
env:
61+
- DEPENDENCIES="stable"
62+
- INTEGRATION_TEST="enabled"
63+
- CONFLUENT_VERSION=5.0.4
64+
script:
65+
- make platform
66+
- PHP=php make phpunit-integration
67+
- stage: integration
68+
php: '7.4'
69+
env:
70+
- DEPENDENCIES="stable"
71+
- INTEGRATION_TEST="enabled"
72+
- CONFLUENT_VERSION=5.1.4
73+
script:
74+
- make platform
75+
- PHP=php make phpunit-integration
76+
- stage: integration
77+
php: '7.4'
78+
env:
79+
- DEPENDENCIES="stable"
80+
- INTEGRATION_TEST="enabled"
81+
- CONFLUENT_VERSION=5.2.4
82+
script:
83+
- make platform
84+
- PHP=php make phpunit-integration
85+
- stage: integration
86+
php: '7.4'
87+
env:
88+
- DEPENDENCIES="stable"
89+
- INTEGRATION_TEST="enabled"
90+
- CONFLUENT_VERSION=5.3.4
91+
script:
92+
- make platform
93+
- PHP=php make phpunit-integration
94+
- stage: integration
95+
php: '7.4'
96+
env:
97+
- DEPENDENCIES="stable"
98+
- INTEGRATION_TEST="enabled"
99+
- CONFLUENT_VERSION=5.4.2
100+
script:
101+
- make platform
102+
- PHP=php make phpunit-integration
103+
- stage: integration
104+
php: '7.4'
60105
env:
61106
- DEPENDENCIES="stable"
62107
- INTEGRATION_TEST="enabled"
63-
- CONFLUENT_VERSION=5.2.3
108+
- CONFLUENT_VERSION=5.5.2
64109
script:
65110
- make platform
66111
- PHP=php make phpunit-integration
67112
- stage: integration
68-
php: '7.2'
113+
php: '7.4'
69114
env:
70115
- DEPENDENCIES="stable"
71116
- INTEGRATION_TEST="enabled"
72-
- CONFLUENT_VERSION=latest
117+
- CONFLUENT_VERSION=6.0.0
73118
script:
74119
- make platform
75120
- PHP=php make phpunit-integration

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ SCHEMA_REGISTRY_IPV4 ?= 172.68.0.103
99
KAFKA_BROKER_IPV4 ?= 172.68.0.102
1010
ZOOKEEPER_IPV4 ?= 172.68.0.101
1111
COMPOSER ?= bin/composer.phar
12-
COMPOSER_VERSION ?= 1.8.3
12+
COMPOSER_VERSION ?= 1.10.13
1313
PHP ?= bin/php
14-
PHP_VERSION ?= 7.2
15-
XDEBUG_VERSION ?= 2.7.2
14+
PHP_VERSION ?= 7.4
15+
XDEBUG_VERSION ?= 2.9.8
1616

1717
export
1818

README.md

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ compliant requests that can be used as well as high level abstractions to ease d
4545
| **`doctrine/cache`** | ~1.3 | If you want to use the `DoctrineCacheAdapter` |
4646
| **`psr/cache`** | ^1.0 | If you want to use the `CacheItemPoolAdapter` |
4747
| **`psr/simple-cache`** | ^1.0 | If you want to use the `SimpleCacheAdapter` |
48-
| **`raphhh/trex-reflection`** | ~1.0 | If you want to use the `RequestCallbackValidator`s |
4948

5049
## Installation
5150

@@ -80,7 +79,6 @@ major version upgrades will have incompatibilities that will be released in the
8079
use GuzzleHttp\Client;
8180
use FlixTech\SchemaRegistryApi\Registry\PromisingRegistry;
8281
use FlixTech\SchemaRegistryApi\Exception\SchemaRegistryException;
83-
use Psr\Http\Message\RequestInterface;
8482

8583
$registry = new PromisingRegistry(
8684
new Client(['base_uri' => 'registry.example.com'])
@@ -117,14 +115,9 @@ $promise = $registry->schemaForId($schemaId);
117115
$schema = $promise->wait();
118116

119117
// Get the version of a schema for a given subject.
120-
// All methods also have a request callback third parameter.
121-
// It takes a `Psr\Http\Message\RequestInterface` and should return a `Psr\Http\Message\RequestInterface`
122118
$version = $registry->schemaVersion(
123119
'test-subject',
124-
$schema,
125-
static function (RequestInterface $request) {
126-
return $request->withAddedHeader('Cache-Control', 'no-cache');
127-
}
120+
$schema
128121
)->wait();
129122

130123
// You can also get a schema by subject and version

composer.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@
1111
}
1212
],
1313
"require": {
14-
"php": "^7.2",
14+
"php": "^7.3",
1515
"ext-curl": "*",
1616
"ext-json": "*",
1717
"guzzlehttp/guzzle": "~6.3",
1818
"guzzlehttp/psr7": "<1.7",
1919
"beberlei/assert": "~2.7|~3.0",
20-
"flix-tech/avro-php": "^3.0|^4.0"
20+
"flix-tech/avro-php": "^4.1"
2121
},
2222
"require-dev": {
23-
"phpunit/phpunit": "~7.0",
23+
"phpunit/phpunit": "^8.2.3",
2424
"phpstan/phpstan": "^0.12",
2525
"raphhh/trex-reflection": "~1.0",
2626
"doctrine/cache": "~1.3",
@@ -29,7 +29,6 @@
2929
"psr/simple-cache": "^1.0"
3030
},
3131
"suggest": {
32-
"raphhh/trex-reflection": "Needed if you want to use the `RequestCallbackValidator`",
3332
"doctrine/cache": "If you want to use the DoctrineCacheAdapter",
3433
"psr/cache": "If you want to use the CacheItemPoolAdapter",
3534
"psr/simple-cache": "If you want to use the SimpleCacheAdapter"

src/AsynchronousRegistry.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,40 +17,40 @@ interface AsynchronousRegistry extends Registry
1717
*
1818
* @return PromiseInterface Either the schema id as int or a SchemaRegistryException object when fulfilled
1919
*/
20-
public function register(string $subject, AvroSchema $schema, callable $requestCallback = null): PromiseInterface;
20+
public function register(string $subject, AvroSchema $schema): PromiseInterface;
2121

2222
/**
2323
* {@inheritdoc}
2424
*
2525
* @return PromiseInterface Either the version as int or a SchemaRegistryException object when fulfilled
2626
*/
27-
public function schemaVersion(string $subject, AvroSchema $schema, callable $requestCallback = null): PromiseInterface;
27+
public function schemaVersion(string $subject, AvroSchema $schema): PromiseInterface;
2828

2929
/**
3030
* {@inheritdoc}
3131
*
3232
* @return PromiseInterface Either the schema as AvroSchema or a SchemaRegistryException object when fulfilled
3333
*/
34-
public function latestVersion(string $subject, callable $requestCallback = null): PromiseInterface;
34+
public function latestVersion(string $subject): PromiseInterface;
3535

3636
/**
3737
* {@inheritdoc}
3838
*
3939
* @return PromiseInterface Either the schema id as int or a SchemaRegistryException object when fulfilled
4040
*/
41-
public function schemaId(string $subject, AvroSchema $schema, callable $requestCallback = null): PromiseInterface;
41+
public function schemaId(string $subject, AvroSchema $schema): PromiseInterface;
4242

4343
/**
4444
* {@inheritdoc}
4545
*
4646
* @return PromiseInterface Either the schema as AvroSchema or a SchemaRegistryException object when fulfilled
4747
*/
48-
public function schemaForId(int $schemaId, callable $requestCallback = null): PromiseInterface;
48+
public function schemaForId(int $schemaId): PromiseInterface;
4949

5050
/**
5151
* {@inheritdoc}
5252
*
5353
* @return PromiseInterface Either the schema as AvroSchema or a SchemaRegistryException object when fulfilled
5454
*/
55-
public function schemaForSubjectAndVersion(string $subject, int $version, callable $requestCallback = null): PromiseInterface;
55+
public function schemaForSubjectAndVersion(string $subject, int $version): PromiseInterface;
5656
}

src/Constants/Constants.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,3 @@
1212
const VERSION_LATEST = 'latest';
1313
const ACCEPT_HEADER = ['Accept' => 'application/vnd.schemaregistry.v1+json'];
1414
const CONTENT_TYPE_HEADER = ['Content-Type' => 'application/vnd.schemaregistry.v1+json'];
15-

src/Exception/ExceptionMap.php

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

55
namespace FlixTech\SchemaRegistryApi\Exception;
66

7+
use Exception;
78
use GuzzleHttp\Exception\RequestException;
89
use Psr\Http\Message\ResponseInterface;
10+
use RuntimeException;
11+
use function array_key_exists;
12+
use function sprintf;
913

1014
final class ExceptionMap
1115
{
@@ -14,7 +18,7 @@ final class ExceptionMap
1418
public const ERROR_MESSAGE_FIELD_NAME = 'message';
1519

1620
/**
17-
* @var \FlixTech\SchemaRegistryApi\Exception\ExceptionMap
21+
* @var ExceptionMap
1822
*/
1923
private static $instance;
2024

@@ -38,7 +42,7 @@ private function __construct()
3842
*
3943
* @return SchemaRegistryException
4044
*
41-
* @throws \RuntimeException
45+
* @throws RuntimeException
4246
*/
4347
public function __invoke(RequestException $exception): SchemaRegistryException
4448
{
@@ -55,7 +59,7 @@ private function guardAgainstMissingResponse(RequestException $exception): Respo
5559
$response = $exception->getResponse();
5660

5761
if (!$response) {
58-
throw new \RuntimeException('RequestException has no response to inspect', 0, $exception);
62+
throw new RuntimeException('RequestException has no response to inspect', 0, $exception);
5963
}
6064

6165
return $response;
@@ -70,8 +74,8 @@ private function guardAgainstMissingErrorCode(ResponseInterface $response): arra
7074
try {
7175
$decodedBody = \GuzzleHttp\json_decode((string) $response->getBody(), true);
7276

73-
if (!\array_key_exists(self::ERROR_CODE_FIELD_NAME, $decodedBody)) {
74-
throw new \RuntimeException(
77+
if (!array_key_exists(self::ERROR_CODE_FIELD_NAME, $decodedBody)) {
78+
throw new RuntimeException(
7579
sprintf(
7680
'Invalid message body received - cannot find "error_code" field in response body "%s"',
7781
(string) $response->getBody()
@@ -80,9 +84,9 @@ private function guardAgainstMissingErrorCode(ResponseInterface $response): arra
8084
}
8185

8286
return $decodedBody;
83-
} catch (\Exception $e) {
84-
throw new \RuntimeException(
85-
\sprintf(
87+
} catch (Exception $e) {
88+
throw new RuntimeException(
89+
sprintf(
8690
'Invalid message body received - cannot find "error_code" field in response body "%s"',
8791
(string) $response->getBody()
8892
),
@@ -92,12 +96,7 @@ private function guardAgainstMissingErrorCode(ResponseInterface $response): arra
9296
}
9397
}
9498

95-
/**
96-
* @param int $errorCode
97-
* @param string $errorMessage
98-
* @return SchemaRegistryException
99-
*/
100-
private function mapErrorCodeToException($errorCode, $errorMessage): SchemaRegistryException
99+
private function mapErrorCodeToException(int $errorCode, string $errorMessage): SchemaRegistryException
101100
{
102101
switch ($errorCode) {
103102
case IncompatibleAvroSchemaException::errorCode():
@@ -131,7 +130,7 @@ private function mapErrorCodeToException($errorCode, $errorMessage): SchemaRegis
131130
return new InvalidCompatibilityLevelException($errorMessage, $errorCode);
132131

133132
default:
134-
throw new \RuntimeException(sprintf('Unknown error code "%d"', $errorCode));
133+
throw new RuntimeException(sprintf('Unknown error code "%d"', $errorCode));
135134
}
136135
}
137136
}

src/Exception/SchemaRegistryException.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
namespace FlixTech\SchemaRegistryApi\Exception;
66

7-
interface SchemaRegistryException extends \Throwable
7+
use Throwable;
8+
9+
interface SchemaRegistryException extends Throwable
810
{
911
public static function errorCode(): int;
1012
}

0 commit comments

Comments
 (0)