From 113f7a16342fdb9a16e52678f362e52a234a9020 Mon Sep 17 00:00:00 2001 From: Dmitry Khayrutdinov Date: Tue, 14 Jul 2026 17:27:36 +0300 Subject: [PATCH 1/2] Bump PHP version, remove deprecates for PHP 8.4 --- .github/workflows/lint54.yml | 23 -------------------- .github/workflows/test.yml | 38 +++++++++++++++++++++++++++++----- composer.json | 7 ++++++- jane-openapi-configuration.php | 1 + lib/Client.php | 6 +++--- 5 files changed, 43 insertions(+), 32 deletions(-) delete mode 100644 .github/workflows/lint54.yml diff --git a/.github/workflows/lint54.yml b/.github/workflows/lint54.yml deleted file mode 100644 index bb47dd9..0000000 --- a/.github/workflows/lint54.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Lint PHP 5.4 - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Install PHP - uses: shivammathur/setup-php@v2 - with: - php-version: '5.4' - - - name: Lint - run: find lib/ -name \*.php -exec sh -c 'php -l "$0" || kill $PPID' \{\} \; diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 17f3707..6edc73f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,21 +2,49 @@ name: Run tests on: push: - branches: [ master ] + branches: + tags: pull_request: - branches: [ master ] + branches: jobs: build: - - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + php: [7.3, 7.4, 8.0, 8.1, 8.2, 8.3, 8.4, 8.5] + os: [ubuntu-latest] + name: PHP ${{ matrix.php }} Test on ${{ matrix.os }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v6 + + - name: Install PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: json + ini-values: zend.assertions=1, error_reporting=E_ALL + coverage: none + + - name: PHP lint + run: find lib/ -name \*.php -exec sh -c 'php -l "$0" || kill $PPID' \{\} \; - name: Validate composer.json and composer.lock run: composer validate + - name: Get composer cache directory + id: composer-cache + run: echo "COMPOSER_CACHE_DIR=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT" + + - name: Cache dependencies + uses: actions/cache@v6 + with: + path: ${{ steps.composer-cache.outputs.COMPOSER_CACHE_DIR }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-composer- + - name: Install dependencies run: composer install --prefer-dist --no-progress --no-suggest diff --git a/composer.json b/composer.json index e2a7dbe..382c36b 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "description": "PHP SDK for MAXMA API", "type": "library", "require": { - "php": ">= 5.4", + "php": ">= 7.3", "ext-json": "*" }, "require-dev": { @@ -28,5 +28,10 @@ "Tools\\": "tools/", "Tests\\": "tests/" } + }, + "config": { + "allow-plugins": { + "php-http/discovery": true + } } } diff --git a/jane-openapi-configuration.php b/jane-openapi-configuration.php index 16257fc..f49348f 100644 --- a/jane-openapi-configuration.php +++ b/jane-openapi-configuration.php @@ -2,6 +2,7 @@ return [ 'openapi-file' => 'https://api.maxma.com/openapi.yaml', + 'allow-external-refs' => true, 'namespace' => 'CloudLoyalty\Api\Generated', 'directory' => __DIR__ . '/lib/Generated', 'use-fixer' => true, diff --git a/lib/Client.php b/lib/Client.php index fe0d9ae..6d3141a 100644 --- a/lib/Client.php +++ b/lib/Client.php @@ -146,9 +146,9 @@ class Client public function __construct( array $config = [], - ClientInterface $httpClient = null, - SerializerInterface $serializer = null, - LoggerInterface $logger = null + ?ClientInterface $httpClient = null, + ?SerializerInterface $serializer = null, + ?LoggerInterface $logger = null ) { if (isset($config['serverAddress'])) { $this->setServerAddress($config['serverAddress']); From 7d234e341e11588f3426627c5b42815cb6d0b188 Mon Sep 17 00:00:00 2001 From: Dmitry Khayrutdinov Date: Wed, 15 Jul 2026 17:01:32 +0300 Subject: [PATCH 2/2] Keep ? nullable type declaration, lock jane-php version to avoid excessive updates --- Makefile | 6 +++++- composer.json | 6 +++++- jane-openapi-configuration.php | 1 - lib/Generated/Model/ClientOfferCounter.php | 10 +++++----- tools/Fixer/RemoveTypeHintFixer.php | 6 +++--- 5 files changed, 18 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 7387fce..3f186c2 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,11 @@ generate: php vendor/bin/jane-openapi generate --config-file=jane-openapi-configuration.php - rm -rf lib/Generated/{Authentication,Endpoint,Normalizer,Client.php,Runtime} + @rm -rf lib/Generated/Authentication/ + @rm -rf lib/Generated/Endpoint/ + @rm -rf lib/Generated/Normalizer/ + @rm -rf lib/Generated/Client.php + @rm -rf lib/Generated/Runtime/ test: @./vendor/bin/phpunit -d date.timezone=Europe/Moscow tests/ --colors=always diff --git a/composer.json b/composer.json index 382c36b..1e2c1d3 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,11 @@ "require-dev": { "friendsofphp/php-cs-fixer": "^2.16", "phpunit/phpunit": "^9.5", - "jane-php/open-api-3": "^7.2", + "jane-php/json-schema": "7.3.*", + "jane-php/json-schema-runtime": "7.3.*", + "jane-php/open-api-3": "7.3.*", + "jane-php/open-api-common": "7.3.*", + "jane-php/open-api-runtime": "7.3.*", "guzzlehttp/guzzle": "^7.4", "symfony/translation-contracts": "^2.5", "psr/log": "^1.1", diff --git a/jane-openapi-configuration.php b/jane-openapi-configuration.php index f49348f..16257fc 100644 --- a/jane-openapi-configuration.php +++ b/jane-openapi-configuration.php @@ -2,7 +2,6 @@ return [ 'openapi-file' => 'https://api.maxma.com/openapi.yaml', - 'allow-external-refs' => true, 'namespace' => 'CloudLoyalty\Api\Generated', 'directory' => __DIR__ . '/lib/Generated', 'use-fixer' => true, diff --git a/lib/Generated/Model/ClientOfferCounter.php b/lib/Generated/Model/ClientOfferCounter.php index 332b3cb..49b3900 100644 --- a/lib/Generated/Model/ClientOfferCounter.php +++ b/lib/Generated/Model/ClientOfferCounter.php @@ -32,7 +32,7 @@ class ClientOfferCounter protected $targetValue; /** - * Дата, до которой нужно накопить счетчик + * Дата, до которой нужно накопить счетчик. Поле не возвращается, если срок не задан. * * @var \DateTime|null */ @@ -115,7 +115,7 @@ public function setTargetValue($targetValue) } /** - * Дата, до которой нужно накопить счетчик + * Дата, до которой нужно накопить счетчик. Поле не возвращается, если срок не задан. * * @return \DateTime|null */ @@ -125,13 +125,13 @@ public function getTargetDate() } /** - * Дата, до которой нужно накопить счетчик + * Дата, до которой нужно накопить счетчик. Поле не возвращается, если срок не задан. * * @param \DateTime|null $targetDate * * @return self */ - public function setTargetDate(\DateTime $targetDate = null) + public function setTargetDate(?\DateTime $targetDate = null) { $this->targetDate = $targetDate; return $this; @@ -159,4 +159,4 @@ public function setCoupons($coupons) $this->coupons = $coupons; return $this; } -} +} \ No newline at end of file diff --git a/tools/Fixer/RemoveTypeHintFixer.php b/tools/Fixer/RemoveTypeHintFixer.php index d94154a..733830c 100644 --- a/tools/Fixer/RemoveTypeHintFixer.php +++ b/tools/Fixer/RemoveTypeHintFixer.php @@ -72,10 +72,10 @@ public function fix(\SplFileInfo $file, Tokens $tokens) foreach ($arguments as $argumentInfo) { $ta = $argumentInfo->getTypeAnalysis(); if ($ta) { - // Remove ? if ($ta->isNullable()) { - $tokens->removeTrailingWhitespace($ta->getStartIndex()); - $tokens->clearTokenAndMergeSurroundingWhitespace($ta->getStartIndex()); + // These lines will remove ? nullable type definition + //$tokens->removeTrailingWhitespace($ta->getStartIndex()); + //$tokens->clearTokenAndMergeSurroundingWhitespace($ta->getStartIndex()); $defaultNullUntilEnd = true; }