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/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 e2a7dbe..1e2c1d3 100644 --- a/composer.json +++ b/composer.json @@ -3,13 +3,17 @@ "description": "PHP SDK for MAXMA API", "type": "library", "require": { - "php": ">= 5.4", + "php": ">= 7.3", "ext-json": "*" }, "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", @@ -28,5 +32,10 @@ "Tools\\": "tools/", "Tests\\": "tests/" } + }, + "config": { + "allow-plugins": { + "php-http/discovery": 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']); 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; }