From 759c1ee5a8a07f21494a152504c32e30d18e5d8d Mon Sep 17 00:00:00 2001 From: Neur0toxine Date: Tue, 12 Mar 2024 09:59:53 +0300 Subject: [PATCH] restore php 7.3 support --- .github/workflows/ci.yml | 2 +- README.md | 2 +- composer.json | 4 ++-- .../Serializer/ArraySupportDecorator.php | 6 ++++-- .../Generator/DeserializerGenerator.php | 18 +++++++++++------ .../Generator/SerializerGenerator.php | 20 +++++++++++++------ .../Serializer/Parser/JMSCore/Type/Parser.php | 18 ++++++++--------- .../Serializer/Parser/JMSCore/Type/Token.php | 4 +++- src/Component/Serializer/Parser/JMSParser.php | 9 ++++++--- .../Serializer/Parser/JMSTypeParser.php | 8 +++----- 10 files changed, 54 insertions(+), 37 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index af5d23d..99a7fb9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php-version: ['7.4', '8.0', '8.1', '8.2', '8.3'] + php-version: ['7.3', '7.4', '8.0', '8.1', '8.2', '8.3'] steps: - name: Check out code into the workspace uses: actions/checkout@v2 diff --git a/README.md b/README.md index 87b2396..4835979 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ You can find more info in the [documentation](doc/index.md). ## Requirements -* PHP 7.4 and above +* PHP 7.3 and above * PHP's cURL support * PHP's JSON support * Any HTTP client compatible with PSR-18 (covered by the installation instructions). diff --git a/composer.json b/composer.json index 09ed2ad..d9e2be7 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=7.4", + "php": ">=7.3", "ext-json": "*", "psr/log": "^1|^2|^3", "psr/http-client": "^1.0", @@ -67,7 +67,7 @@ "phpunit": "./vendor/bin/phpunit -c phpunit.xml.dist --coverage-text", "phpunit-ci": "@php -dpcov.enabled=1 -dpcov.directory=. -dpcov.exclude=\"~vendor~\" ./vendor/bin/phpunit --teamcity -c phpunit.xml.dist", "phpmd": "./vendor/bin/phpmd src text ./phpmd.xml", - "phpcs": "./vendor/bin/phpcs -p src --runtime-set testVersion 7.4-8.3 && ./vendor/bin/phpcs -p tests --runtime-set testVersion 7.4-8.3 --warning-severity=0", + "phpcs": "./vendor/bin/phpcs -p src --runtime-set testVersion 7.3-8.3 && ./vendor/bin/phpcs -p tests --runtime-set testVersion 7.3-8.3 --warning-severity=0", "phpstan": "./vendor/bin/phpstan analyse -c phpstan.neon src --memory-limit=-1", "phpstan-dockerized-ci": "docker run --rm -it -w=/app -v ${PWD}:/app oskarstark/phpstan-ga:1.0.1 analyse src -c phpstan.neon --memory-limit=1G --no-progress", "lint:fix": "./vendor/bin/phpcbf src", diff --git a/src/Component/Serializer/ArraySupportDecorator.php b/src/Component/Serializer/ArraySupportDecorator.php index 4d9c980..c3c33b5 100644 --- a/src/Component/Serializer/ArraySupportDecorator.php +++ b/src/Component/Serializer/ArraySupportDecorator.php @@ -25,7 +25,8 @@ if (PHP_VERSION_ID >= 80000) { */ class ArraySupportDecorator implements SerializerInterface { - private SerializerInterface $serializer; + /** @var \Liip\Serializer\SerializerInterface */ + private $serializer; /** * ArraySupportDecorator constructor. @@ -234,7 +235,8 @@ if (PHP_VERSION_ID >= 80000) { */ class ArraySupportDecorator implements SerializerInterface { - private SerializerInterface $serializer; + /** @var \Liip\Serializer\SerializerInterface */ + private $serializer; /** * ArraySupportDecorator constructor. diff --git a/src/Component/Serializer/Generator/DeserializerGenerator.php b/src/Component/Serializer/Generator/DeserializerGenerator.php index f424f96..7eca46a 100644 --- a/src/Component/Serializer/Generator/DeserializerGenerator.php +++ b/src/Component/Serializer/Generator/DeserializerGenerator.php @@ -29,17 +29,23 @@ final class DeserializerGenerator { private const FILENAME_PREFIX = 'deserialize'; - private Filesystem $filesystem; + /** @var \Symfony\Component\Filesystem\Filesystem */ + private $filesystem; - private GeneratorConfiguration $configuration; + /** @var \Liip\Serializer\Configuration\GeneratorConfiguration */ + private $configuration; - private Deserialization $templating; + /** @var \Liip\Serializer\Template\Deserialization */ + private $templating; - private CustomDeserialization $customTemplating; + /** @var \RetailCrm\Api\Component\Serializer\Template\CustomDeserialization */ + private $customTemplating; - private string $cacheDirectory; + /** @var string */ + private $cacheDirectory; - private Builder $metadataBuilder; + /** @var \Liip\MetadataParser\Builder */ + private $metadataBuilder; /** * @param list $classesToGenerate This is a list of FQCN classnames diff --git a/src/Component/Serializer/Generator/SerializerGenerator.php b/src/Component/Serializer/Generator/SerializerGenerator.php index b4a903d..dd1b5f5 100644 --- a/src/Component/Serializer/Generator/SerializerGenerator.php +++ b/src/Component/Serializer/Generator/SerializerGenerator.php @@ -33,15 +33,23 @@ final class SerializerGenerator { private const FILENAME_PREFIX = 'serialize'; - private Filesystem $filesystem; + /** @var \Symfony\Component\Filesystem\Filesystem */ + private $filesystem; - private Serialization $templating; - private GeneratorConfiguration $configuration; - private string $cacheDirectory; + /** @var \Liip\Serializer\Template\Serialization */ + private $templating; - private CustomSerialization $customTemplating; + /** @var \Liip\Serializer\Configuration\GeneratorConfiguration */ + private $configuration; - private Builder $metadataBuilder; + /** @var string */ + private $cacheDirectory; + + /** @var \RetailCrm\Api\Component\Serializer\Template\CustomSerialization */ + private $customTemplating; + + /** @var \Liip\MetadataParser\Builder */ + private $metadataBuilder; public function __construct( Serialization $templating, diff --git a/src/Component/Serializer/Parser/JMSCore/Type/Parser.php b/src/Component/Serializer/Parser/JMSCore/Type/Parser.php index d77b5f9..d2fb74a 100644 --- a/src/Component/Serializer/Parser/JMSCore/Type/Parser.php +++ b/src/Component/Serializer/Parser/JMSCore/Type/Parser.php @@ -11,19 +11,17 @@ use RetailCrm\Api\Component\Serializer\Parser\JMSCore\Type\Exception\SyntaxError */ final class Parser implements ParserInterface { - /** - * @var Lexer - */ - private Lexer $lexer; + /** @var \RetailCrm\Api\Component\Serializer\Parser\JMSCore\Type\Lexer */ + private $lexer; - private ?Token $token = null; + /** @var \RetailCrm\Api\Component\Serializer\Parser\JMSCore\Type\Token|null */ + private $token = null; - private string $input; + /** @var string */ + private $input; - /** - * @var bool - */ - private bool $root = true; + /** @var bool */ + private $root = true; public function parse(string $type): array { diff --git a/src/Component/Serializer/Parser/JMSCore/Type/Token.php b/src/Component/Serializer/Parser/JMSCore/Type/Token.php index f576840..eaf999b 100644 --- a/src/Component/Serializer/Parser/JMSCore/Type/Token.php +++ b/src/Component/Serializer/Parser/JMSCore/Type/Token.php @@ -41,9 +41,11 @@ final class Token /** * The position of the token in the input string * + * @var int + * * @readonly */ - public int $position; + public $position; /** * @param string|int $value diff --git a/src/Component/Serializer/Parser/JMSParser.php b/src/Component/Serializer/Parser/JMSParser.php index 4d6ddd4..cb2e0a8 100644 --- a/src/Component/Serializer/Parser/JMSParser.php +++ b/src/Component/Serializer/Parser/JMSParser.php @@ -41,11 +41,14 @@ class JMSParser implements ModelParserInterface { private const ACCESS_ORDER_CUSTOM = 'custom'; - private Reader $annotationsReader; + /** @var \Doctrine\Common\Annotations\Reader */ + private $annotationsReader; - private PhpTypeParser $phpTypeParser; + /** @var \Liip\MetadataParser\TypeParser\PhpTypeParser */ + private $phpTypeParser; - protected JMSTypeParser $jmsTypeParser; + /** @var \RetailCrm\Api\Component\Serializer\Parser\JMSTypeParser */ + protected $jmsTypeParser; public function __construct(Reader $annotationsReader) { diff --git a/src/Component/Serializer/Parser/JMSTypeParser.php b/src/Component/Serializer/Parser/JMSTypeParser.php index 1379290..1b8681b 100644 --- a/src/Component/Serializer/Parser/JMSTypeParser.php +++ b/src/Component/Serializer/Parser/JMSTypeParser.php @@ -25,12 +25,10 @@ final class JMSTypeParser private const TYPE_ARRAY_COLLECTION = 'ArrayCollection'; private const TYPE_DATETIME_INTERFACE = 'DateTimeInterface'; - /** - * @var Parser - */ - private Parser $jmsTypeParser; + /** @var \RetailCrm\Api\Component\Serializer\Parser\JMSCore\Type\Parser */ + private $jmsTypeParser; - private $useArrayDateFormat = true; + private $useArrayDateFormat; public function __construct() {