Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions .github/workflows/lint54.yml

This file was deleted.

38 changes: 33 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 11 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -28,5 +32,10 @@
"Tools\\": "tools/",
"Tests\\": "tests/"
}
},
"config": {
"allow-plugins": {
"php-http/discovery": true
}
}
}
6 changes: 3 additions & 3 deletions lib/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
Expand Down
10 changes: 5 additions & 5 deletions lib/Generated/Model/ClientOfferCounter.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class ClientOfferCounter
protected $targetValue;

/**
* Дата, до которой нужно накопить счетчик
* Дата, до которой нужно накопить счетчик. Поле не возвращается, если срок не задан.
*
* @var \DateTime|null
*/
Expand Down Expand Up @@ -115,7 +115,7 @@ public function setTargetValue($targetValue)
}

/**
* Дата, до которой нужно накопить счетчик
* Дата, до которой нужно накопить счетчик. Поле не возвращается, если срок не задан.
*
* @return \DateTime|null
*/
Expand All @@ -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;
Expand Down Expand Up @@ -159,4 +159,4 @@ public function setCoupons($coupons)
$this->coupons = $coupons;
return $this;
}
}
}
6 changes: 3 additions & 3 deletions tools/Fixer/RemoveTypeHintFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down