From c8bba230c039b994e172f2fadb42fd234907100b Mon Sep 17 00:00:00 2001 From: Jovan Ruzic Date: Fri, 30 Dec 2022 10:03:06 +0100 Subject: [PATCH] feat(MPM-708): drop php7.4 support (#45) Co-authored-by: Marko --- composer.json | 6 +++--- docker/dev/php/Dockerfile | 2 +- src/Command/CheckAllSchemaTemplatesDefaultTypeCommand.php | 6 +++--- src/Command/ListAllSchemasCommand.php | 2 +- src/Command/ListVersionsForSchemaCommand.php | 2 +- src/Command/RegisterChangedSchemasCommand.php | 3 +-- 6 files changed, 10 insertions(+), 11 deletions(-) diff --git a/composer.json b/composer.json index 1f29208..ca9105b 100644 --- a/composer.json +++ b/composer.json @@ -11,18 +11,18 @@ } ], "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", "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", - "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..9e84538 100644 --- a/src/Command/ListAllSchemasCommand.php +++ b/src/Command/ListAllSchemasCommand.php @@ -30,7 +30,7 @@ public function execute(InputInterface $input, OutputInterface $output): int $schemas = $this->schemaRegistryApi->getSubjects(); 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..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; @@ -134,7 +133,7 @@ private function registerFiles( try { $latestVersion = $this->schemaRegistryApi->getLatestSubjectVersion($schemaName); - } catch (SubjectNotFoundException $e) { + } catch (\Throwable $e) { $latestVersion = null; }