From 3cc7849957ca891a3f01ec9a73e9b257b3bf21d7 Mon Sep 17 00:00:00 2001 From: Jovan Ruzic Date: Tue, 20 Dec 2022 11:31:07 +0100 Subject: [PATCH 1/4] feat/MPM-708/drop-php7.4-support --- composer.json | 4 ++-- docker/dev/php/Dockerfile | 2 +- src/Command/CheckAllSchemaTemplatesDefaultTypeCommand.php | 6 +++--- src/Command/ListAllSchemasCommand.php | 3 ++- src/Command/ListVersionsForSchemaCommand.php | 2 +- src/Command/RegisterChangedSchemasCommand.php | 2 +- 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/composer.json b/composer.json index 1f29208..f356787 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ } ], "require": { - "php": ">=7.4", + "php": "^8.0", "ext-json": "*", "flix-tech/avro-php": "^3.0|^4.0", "jobcloud/php-kafka-schema-registry-client": "^1.0", @@ -22,7 +22,7 @@ }, "require-dev": { "infection/infection": "^0.26", - "phpstan/phpstan": "^0.12", + "phpstan/phpstan": "^1.9", "phpunit/phpunit": "^9.5", "rregeer/phpunit-coverage-check": "^0.3.1", "squizlabs/php_codesniffer": "^3.6" diff --git a/docker/dev/php/Dockerfile b/docker/dev/php/Dockerfile index 1f0a85b..afbbd57 100644 --- a/docker/dev/php/Dockerfile +++ b/docker/dev/php/Dockerfile @@ -1,4 +1,4 @@ -FROM php:7.4-cli-alpine3.16 +FROM php:8.0-cli-alpine3.16 ARG HOST_USER_ID diff --git a/src/Command/CheckAllSchemaTemplatesDefaultTypeCommand.php b/src/Command/CheckAllSchemaTemplatesDefaultTypeCommand.php index a9eb7a3..d3bce25 100644 --- a/src/Command/CheckAllSchemaTemplatesDefaultTypeCommand.php +++ b/src/Command/CheckAllSchemaTemplatesDefaultTypeCommand.php @@ -88,7 +88,7 @@ private function checkSchemas(array $avroFiles, array &$failed = []): bool /** * @param string $localSchema - * @return array + * @return array */ private function checkDefaultType(string $localSchema): array { @@ -103,7 +103,7 @@ private function checkDefaultType(string $localSchema): array /** * @param mixed $decodedSchema * @param array $defaultFields - * @return array + * @return array */ private function checkAllFields($decodedSchema, array $defaultFields = []): array { @@ -132,7 +132,7 @@ private function checkAllFields($decodedSchema, array $defaultFields = []): arra * @param mixed $fieldType * @param mixed $field * @param array $defaultFields - * @return array + * @return array */ private function checkSingleField($fieldType, $field, array $defaultFields): array { diff --git a/src/Command/ListAllSchemasCommand.php b/src/Command/ListAllSchemasCommand.php index ac48f71..2907d87 100644 --- a/src/Command/ListAllSchemasCommand.php +++ b/src/Command/ListAllSchemasCommand.php @@ -29,8 +29,9 @@ public function execute(InputInterface $input, OutputInterface $output): int { $schemas = $this->schemaRegistryApi->getSubjects(); + /** @var string $schema */ foreach ($schemas as $schema) { - $output->writeln($schema); + $output->writeln((string) $schema); } return 0; diff --git a/src/Command/ListVersionsForSchemaCommand.php b/src/Command/ListVersionsForSchemaCommand.php index 2d75bd7..7990cc5 100644 --- a/src/Command/ListVersionsForSchemaCommand.php +++ b/src/Command/ListVersionsForSchemaCommand.php @@ -35,7 +35,7 @@ public function execute(InputInterface $input, OutputInterface $output): int $schemaVersions = $this->schemaRegistryApi->getAllSubjectVersions($schemaName); foreach ($schemaVersions as $schemaVersion) { - $output->writeln($schemaVersion); + $output->writeln((string) $schemaVersion); } return 0; diff --git a/src/Command/RegisterChangedSchemasCommand.php b/src/Command/RegisterChangedSchemasCommand.php index 5c95bc9..33f7c02 100644 --- a/src/Command/RegisterChangedSchemasCommand.php +++ b/src/Command/RegisterChangedSchemasCommand.php @@ -134,7 +134,7 @@ private function registerFiles( try { $latestVersion = $this->schemaRegistryApi->getLatestSubjectVersion($schemaName); - } catch (SubjectNotFoundException $e) { + } catch (\Throwable $e) { $latestVersion = null; } From 3903ff2555f694f3abddf6d7de4bfa5330a0106f Mon Sep 17 00:00:00 2001 From: Jovan Ruzic Date: Tue, 20 Dec 2022 11:41:06 +0100 Subject: [PATCH 2/4] removed annotation --- src/Command/ListAllSchemasCommand.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Command/ListAllSchemasCommand.php b/src/Command/ListAllSchemasCommand.php index 2907d87..9e84538 100644 --- a/src/Command/ListAllSchemasCommand.php +++ b/src/Command/ListAllSchemasCommand.php @@ -29,7 +29,6 @@ public function execute(InputInterface $input, OutputInterface $output): int { $schemas = $this->schemaRegistryApi->getSubjects(); - /** @var string $schema */ foreach ($schemas as $schema) { $output->writeln((string) $schema); } From f98bcea88a30ed8a8772c5d533f353233185b44a Mon Sep 17 00:00:00 2001 From: Jovan Ruzic Date: Tue, 27 Dec 2022 15:42:37 +0100 Subject: [PATCH 3/4] removed symfony/console:4 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index f356787..ca9105b 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ "kriswallsmith/buzz": "^1.2", "nyholm/psr7": "^1.4", "pimple/pimple": "^3.2", - "symfony/console": "^4.3|^5.1|^6.0" + "symfony/console": "^5.1|^6.0" }, "require-dev": { "infection/infection": "^0.26", From f15ad270055e88fcc432b85d5ab250fc3cbf58e7 Mon Sep 17 00:00:00 2001 From: Marko Date: Wed, 28 Dec 2022 17:53:57 +0100 Subject: [PATCH 4/4] Remove unused import --- src/Command/RegisterChangedSchemasCommand.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Command/RegisterChangedSchemasCommand.php b/src/Command/RegisterChangedSchemasCommand.php index 33f7c02..6573d28 100644 --- a/src/Command/RegisterChangedSchemasCommand.php +++ b/src/Command/RegisterChangedSchemasCommand.php @@ -4,7 +4,6 @@ use AvroSchema; use AvroSchemaParseException; -use Jobcloud\Kafka\SchemaRegistryClient\Exception\SubjectNotFoundException; use Jobcloud\Kafka\SchemaRegistryClient\KafkaSchemaRegistryApiClientInterface; use Jobcloud\SchemaConsole\Helper\SchemaFileHelper; use Symfony\Component\Console\Input\InputArgument;