diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e0efe21..2e21f33 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -8,24 +8,26 @@ name: Check code style and tests - master jobs: - build_8_0: + build: runs-on: ubuntu-latest + strategy: + matrix: + php_version: + - '8.4' + - '8.5' + steps: - - uses: actions/checkout@v2 - - uses: php-actions/composer@v6 - with: - php_version: 8.0 - version: 2 + - uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: 8.0 + php-version: ${{ matrix.php_version }} - name: Update packages - run: sudo composer update + run: composer update --prefer-dist --no-interaction - name: PHP version run: php -v @@ -34,8 +36,4 @@ jobs: run: vendor/bin/phpcs - name: Run tests - uses: php-actions/phpunit@v3 - with: - version: 9 - php_version: 8.0 - + run: vendor/bin/phpunit diff --git a/.gitignore b/.gitignore index e30d2f2..8f81fdd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ vendor/ composer.lock src/Clients/getDeviceUUID -.idea \ No newline at end of file +.idea.phpunit.result.cache diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e6400e5..0000000 --- a/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -# Project language -language: php - -# List of PHP version we want to test -php: - - 7.3 - - 7.4 - - 8.0 - -# Allows use container-based infrastructure -sudo: false - -# Cache composer packages so "composer install" is faster -cache: - directories: - - $HOME/.composer/cache - -# Update composer -before_install: - - travis_retry composer self-update - -# Install composer dependencies -install: - - travis_retry composer install --prefer-dist --no-interaction - -before_script: - - export XDEBUG_MODE=coverage - -# Run scripts -script: - - vendor/bin/phpcs - - vendor/bin/phpunit diff --git a/README.md b/README.md index eef064c..87764b1 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ PHP библиотека для упрощённого взаимодейтсв ### Зависимости -* PHP версии 7.3 или выше +* PHP версии 8.4 или выше * [psr/log](https://github.com/php-fig/log) * [ext-json](http://php.net/manual/ru/json.installation.php) * [ext-simplexml](http://php.net/manual/ru/simplexml.installation.php) diff --git a/composer.json b/composer.json index 6202ca7..c4d22b0 100644 --- a/composer.json +++ b/composer.json @@ -4,7 +4,7 @@ "keywords": ["mindbox", "sdk"], "type": "library", "require": { - "php": ">=8.0", + "php": ">=8.4", "psr/log": "^1.1|^2|^3", "ext-json": "*", "ext-simplexml": "*", diff --git a/docs/getting_started.md b/docs/getting_started.md index 6920174..08e7eb0 100644 --- a/docs/getting_started.md +++ b/docs/getting_started.md @@ -6,7 +6,7 @@ ## Системные зависимости -* PHP версии 7.3 или выше +* PHP версии 8.4 или выше * [psr/log](https://github.com/php-fig/log) * [ext-json](http://php.net/manual/ru/json.installation.php) * [ext-simplexml](http://php.net/manual/ru/simplexml.installation.php) diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 727c11f..723ef50 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -3,5 +3,5 @@ src/ tests/ - + \ No newline at end of file diff --git a/src/Clients/AbstractMindboxClient.php b/src/Clients/AbstractMindboxClient.php index 23a6b48..9c366a7 100644 --- a/src/Clients/AbstractMindboxClient.php +++ b/src/Clients/AbstractMindboxClient.php @@ -88,7 +88,7 @@ public function __construct($secretKey, IHttpClient $httpClient, LoggerInterface public function prepareRequest( $method, $operationName, - \Mindbox\DTO\DTO $body = null, + ?\Mindbox\DTO\DTO $body = null, $additionalUrl = '', $queryParams = [], $isSync = true, @@ -211,7 +211,7 @@ abstract protected function prepareAuthorizationHeader(); * * @return string */ - abstract protected function prepareBody(\Mindbox\DTO\DTO $body = null); + abstract protected function prepareBody(?\Mindbox\DTO\DTO $body = null); /** * Инициализация экземпляра запроса. diff --git a/src/Clients/MindboxClientFactory.php b/src/Clients/MindboxClientFactory.php index e87cf90..061e00d 100644 --- a/src/Clients/MindboxClientFactory.php +++ b/src/Clients/MindboxClientFactory.php @@ -1,6 +1,5 @@ toXML() : ''; } diff --git a/src/Clients/MindboxClientV3.php b/src/Clients/MindboxClientV3.php index ac55b0c..76272df 100644 --- a/src/Clients/MindboxClientV3.php +++ b/src/Clients/MindboxClientV3.php @@ -1,6 +1,5 @@ toJson() : ''; } diff --git a/src/DTO/DTO.php b/src/DTO/DTO.php index dfea20d..6fb3aa7 100644 --- a/src/DTO/DTO.php +++ b/src/DTO/DTO.php @@ -1,6 +1,5 @@ createOperation(); @@ -128,7 +128,7 @@ public function setProductList( public function setWishList( ProductListItemRequestCollection $products, $operationName, - CustomerIdentityRequestDTO $customerIdentity = null, + ?CustomerIdentityRequestDTO $customerIdentity = null, $addDeviceUUID = true ) { $operation = $this->createOperation(); @@ -154,7 +154,7 @@ public function setWishList( */ public function clearWishList( $operationName, - CustomerIdentityRequestDTO $customerIdentity = null, + ?CustomerIdentityRequestDTO $customerIdentity = null, $addDeviceUUID = true ) { $operation = $this->createOperation(); @@ -175,7 +175,7 @@ public function clearWishList( */ public function clearCart( $operationName, - CustomerIdentityRequestDTO $customerIdentity = null, + ?CustomerIdentityRequestDTO $customerIdentity = null, $addDeviceUUID = true ) { $operation = $this->createOperation(); diff --git a/src/HttpClients/MindboxStream.php b/src/HttpClients/MindboxStream.php index 7f92754..59c4d57 100644 --- a/src/HttpClients/MindboxStream.php +++ b/src/HttpClients/MindboxStream.php @@ -42,7 +42,7 @@ public function contextCreate($options) public function fileGetContents($url) { $rawBody = file_get_contents($url, false, $this->stream); - $rawHeaders = !empty($http_response_header) ? $http_response_header : []; + $rawHeaders = http_get_last_response_headers() ?? []; $this->setRawHeaders($rawHeaders); return trim((string)$rawBody); diff --git a/src/MindboxRequest.php b/src/MindboxRequest.php index 9710e4b..64d045f 100644 --- a/src/MindboxRequest.php +++ b/src/MindboxRequest.php @@ -1,6 +1,5 @@ dtoClassName)->getXmlName(); + return (new $this->dtoClassName())->getXmlName(); } /**