From 181768a19f09dca2f2ec6737710c6dd1ee6e1d1c Mon Sep 17 00:00:00 2001 From: Denys Sokolov Date: Wed, 20 Mar 2024 11:47:33 +0100 Subject: [PATCH 1/8] CC-33265: Extended the compatibility of version for "akeneo/api-php-client" from 6 to 11. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 18943a1..6ab8efb 100644 --- a/composer.json +++ b/composer.json @@ -4,7 +4,7 @@ "description": "AkeneoPim module", "license": "proprietary", "require": { - "akeneo/api-php-client": "^1.0.0 || ^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0", + "akeneo/api-php-client": "^1.0.0 || ^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 || ^v9.0.0 || ^10.0.0 || ^11.0.0", "php": ">=7.2", "guzzlehttp/guzzle": "^6.0.0 || ^7.0.0", "spryker/kernel": "^3.30.0" From b1cc80752c0f44795dceb563adb7a1085b371f6f Mon Sep 17 00:00:00 2001 From: Denys Sokolov Date: Thu, 21 Mar 2024 14:21:58 +0100 Subject: [PATCH 2/8] CC-33265: Added the support of the Akeneo Http client. --- composer.json | 11 ++- phpstan.neon | 3 + .../External/Api/Adapter/AdapterFactory.php | 28 +++---- .../Adapter/HttpClient/AbstractHttpClient.php | 76 +++++++++++++++++++ .../Adapter/HttpClient/AkeneoHttpClient.php | 14 ++++ .../Api/Adapter/HttpClient/Client.php | 67 +--------------- .../Exception/UnexpectedValueException.php | 8 +- .../Api/Adapter/HttpClient/Promise.php | 4 +- .../Api/Adapter/Sdk/AkeneoPimSdkFactory.php | 32 ++++++-- .../Api/Wrapper/AkeneoResourceCursor.php | 2 + .../Shared/AkeneoPim/AkeneoPimConstants.php | 19 +++++ ...m.transfer.xml => akeneo_pim.transfer.xml} | 0 .../_support/AkeneoPimServiceTester.php | 8 +- 13 files changed, 181 insertions(+), 91 deletions(-) create mode 100644 src/SprykerEco/Service/AkeneoPim/Dependencies/External/Api/Adapter/HttpClient/AbstractHttpClient.php create mode 100644 src/SprykerEco/Service/AkeneoPim/Dependencies/External/Api/Adapter/HttpClient/AkeneoHttpClient.php rename src/SprykerEco/Shared/AkeneoPim/Transfer/{akeneo-pim.transfer.xml => akeneo_pim.transfer.xml} (100%) diff --git a/composer.json b/composer.json index 6ab8efb..5f3b3d7 100644 --- a/composer.json +++ b/composer.json @@ -4,13 +4,18 @@ "description": "AkeneoPim module", "license": "proprietary", "require": { - "akeneo/api-php-client": "^1.0.0 || ^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 || ^v9.0.0 || ^10.0.0 || ^11.0.0", + "akeneo/api-php-client": "^1.0.0 || ^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0", "php": ">=7.2", - "guzzlehttp/guzzle": "^6.0.0 || ^7.0.0", + "php-http/httplug": "^1.0.0 || ^2.0.0", + "php-http/promise": "^1.0.0", + "psr/http-client": "^1.0.0", + "psr/http-message": "^1.0.0 || ^2.0.0", + "spryker/guzzle": "^2.3.0", "spryker/kernel": "^3.30.0" }, "require-dev": { - "spryker/code-sniffer": "*" + "spryker/code-sniffer": "*", + "spryker/testify": "*" }, "autoload": { "psr-4": { diff --git a/phpstan.neon b/phpstan.neon index 89ad65e..dae064b 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,3 +1,6 @@ parameters: level: 7 checkMissingIterableValueType: false + checkGenericClassInNonGenericObjectType: false + ignoreErrors: + - '#Parameter \#1 \$httpClient of method Akeneo\\Pim\\ApiClient\\AkeneoPimClientBuilder::setHttpClient\(\) expects Akeneo\\Pim\\ApiClient\\Client\\ClientInterface, Psr\\Http\\Client\\ClientInterface given\.#' diff --git a/src/SprykerEco/Service/AkeneoPim/Dependencies/External/Api/Adapter/AdapterFactory.php b/src/SprykerEco/Service/AkeneoPim/Dependencies/External/Api/Adapter/AdapterFactory.php index 4736baf..61e84ac 100644 --- a/src/SprykerEco/Service/AkeneoPim/Dependencies/External/Api/Adapter/AdapterFactory.php +++ b/src/SprykerEco/Service/AkeneoPim/Dependencies/External/Api/Adapter/AdapterFactory.php @@ -57,7 +57,7 @@ public function createProductApiAdapter(): ApiAdapterInterface { return new ProductApiAdapter( $this->createAkeneoPimSdkFactory()->createAkeneoPimClient($this->config), - $this->wrapperFactory + $this->wrapperFactory, ); } @@ -68,7 +68,7 @@ public function createCategoryApiAdapter(): ApiAdapterInterface { return new CategoryApiAdapter( $this->createAkeneoPimSdkFactory()->createAkeneoPimClient($this->config), - $this->wrapperFactory + $this->wrapperFactory, ); } @@ -79,7 +79,7 @@ public function createAttributeApiAdapter(): ApiAdapterInterface { return new AttributeApiAdapter( $this->createAkeneoPimSdkFactory()->createAkeneoPimClient($this->config), - $this->wrapperFactory + $this->wrapperFactory, ); } @@ -90,7 +90,7 @@ public function createAttributeGroupApiAdapter(): ApiAdapterInterface { return new AttributeGroupApiAdapter( $this->createAkeneoPimSdkFactory()->createAkeneoPimClient($this->config), - $this->wrapperFactory + $this->wrapperFactory, ); } @@ -101,7 +101,7 @@ public function createAttributeOptionApiAdapter(): AttributeOptionApiAdapterInte { return new AttributeOptionApiAdapter( $this->createAkeneoPimSdkFactory()->createAkeneoPimClient($this->config), - $this->wrapperFactory + $this->wrapperFactory, ); } @@ -112,7 +112,7 @@ public function createAssociationTypeApiAdapter(): ApiAdapterInterface { return new AssociationTypeApiAdapter( $this->createAkeneoPimSdkFactory()->createAkeneoPimClient($this->config), - $this->wrapperFactory + $this->wrapperFactory, ); } @@ -123,7 +123,7 @@ public function createChannelApiAdapter(): ApiAdapterInterface { return new ChannelApiAdapter( $this->createAkeneoPimSdkFactory()->createAkeneoPimClient($this->config), - $this->wrapperFactory + $this->wrapperFactory, ); } @@ -134,7 +134,7 @@ public function createCurrencyApiAdapter(): ApiAdapterInterface { return new CurrencyApiAdapter( $this->createAkeneoPimSdkFactory()->createAkeneoPimClient($this->config), - $this->wrapperFactory + $this->wrapperFactory, ); } @@ -145,7 +145,7 @@ public function createFamilyApiAdapter(): ApiAdapterInterface { return new FamilyApiAdapter( $this->createAkeneoPimSdkFactory()->createAkeneoPimClient($this->config), - $this->wrapperFactory + $this->wrapperFactory, ); } @@ -156,7 +156,7 @@ public function createFamilyVariantApiAdapter(): FamilyVariantApiAdapterInterfac { return new FamilyVariantApiAdapter( $this->createAkeneoPimSdkFactory()->createAkeneoPimClient($this->config), - $this->wrapperFactory + $this->wrapperFactory, ); } @@ -167,7 +167,7 @@ public function createLocaleApiAdapter(): ApiAdapterInterface { return new LocaleApiAdapter( $this->createAkeneoPimSdkFactory()->createAkeneoPimClient($this->config), - $this->wrapperFactory + $this->wrapperFactory, ); } @@ -178,7 +178,7 @@ public function createMeasureFamilyApiAdapter(): ApiAdapterInterface { return new MeasureFamilyApiAdapter( $this->createAkeneoPimSdkFactory()->createAkeneoPimClient($this->config), - $this->wrapperFactory + $this->wrapperFactory, ); } @@ -189,7 +189,7 @@ public function createProductMediaFileApiAdapter(): ApiAdapterInterface { return new ProductMediaFileApiAdapter( $this->createAkeneoPimSdkFactory()->createAkeneoPimClient($this->config), - $this->wrapperFactory + $this->wrapperFactory, ); } @@ -200,7 +200,7 @@ public function createProductModelApiAdapter(): ApiAdapterInterface { return new ProductModelApiAdapter( $this->createAkeneoPimSdkFactory()->createAkeneoPimClient($this->config), - $this->wrapperFactory + $this->wrapperFactory, ); } diff --git a/src/SprykerEco/Service/AkeneoPim/Dependencies/External/Api/Adapter/HttpClient/AbstractHttpClient.php b/src/SprykerEco/Service/AkeneoPim/Dependencies/External/Api/Adapter/HttpClient/AbstractHttpClient.php new file mode 100644 index 0000000..5ebc6aa --- /dev/null +++ b/src/SprykerEco/Service/AkeneoPim/Dependencies/External/Api/Adapter/HttpClient/AbstractHttpClient.php @@ -0,0 +1,76 @@ +client = $this->buildClient(); + } + + /** + * @param \Psr\Http\Message\RequestInterface $request + * + * @return \Psr\Http\Message\ResponseInterface + */ + public function sendRequest(RequestInterface $request): ResponseInterface + { + return $this->client->send($request); + } + + /** + * @param \Psr\Http\Message\RequestInterface $request + * + * @return \Http\Promise\Promise + */ + public function sendAsyncRequest(RequestInterface $request): HttpPromise + { + $promise = $this->client->sendAsync($request); + + return new Promise($promise, $request); + } + + /** + * @return \GuzzleHttp\ClientInterface + */ + protected function buildClient(): ClientInterface + { + $handlerStack = $this->createHandlerStack(); + $handlerStack->push(Middleware::prepareBody(), 'prepare_body'); + + return new GuzzleHttpClient(['handler' => $handlerStack]); + } + + /** + * @return \GuzzleHttp\HandlerStack + */ + protected function createHandlerStack(): HandlerStack + { + if (method_exists(Utils::class, 'chooseHandler')) { + return new HandlerStack(Utils::chooseHandler()); + } + + return new HandlerStack(choose_handler()); + } +} diff --git a/src/SprykerEco/Service/AkeneoPim/Dependencies/External/Api/Adapter/HttpClient/AkeneoHttpClient.php b/src/SprykerEco/Service/AkeneoPim/Dependencies/External/Api/Adapter/HttpClient/AkeneoHttpClient.php new file mode 100644 index 0000000..1f0927d --- /dev/null +++ b/src/SprykerEco/Service/AkeneoPim/Dependencies/External/Api/Adapter/HttpClient/AkeneoHttpClient.php @@ -0,0 +1,14 @@ +client = $this->buildClient(); - } - - /** - * @param \Psr\Http\Message\RequestInterface $request - * - * @return \Psr\Http\Message\ResponseInterface - */ - public function sendRequest(RequestInterface $request): ResponseInterface - { - return $this->sendAsyncRequest($request)->wait(); - } - - /** - * @param \Psr\Http\Message\RequestInterface $request - * - * @return \Http\Promise\Promise - */ - protected function sendAsyncRequest(RequestInterface $request): HttpPromise - { - $promise = $this->client->sendAsync($request); - - return new Promise($promise, $request); - } - - /** - * @return \GuzzleHttp\ClientInterface - */ - protected function buildClient(): ClientInterface - { - $handlerStack = $this->createHandlerStack(); - $handlerStack->push(Middleware::prepareBody(), 'prepare_body'); - - return new GuzzleHttpClient(['handler' => $handlerStack]); - } - - /** - * @return \GuzzleHttp\HandlerStack - */ - protected function createHandlerStack(): HandlerStack - { - if (method_exists(Utils::class, 'chooseHandler')) { - return new HandlerStack(Utils::chooseHandler()); - } - - return new HandlerStack(choose_handler()); - } } diff --git a/src/SprykerEco/Service/AkeneoPim/Dependencies/External/Api/Adapter/HttpClient/Exception/UnexpectedValueException.php b/src/SprykerEco/Service/AkeneoPim/Dependencies/External/Api/Adapter/HttpClient/Exception/UnexpectedValueException.php index 4c074e2..c9cab3d 100644 --- a/src/SprykerEco/Service/AkeneoPim/Dependencies/External/Api/Adapter/HttpClient/Exception/UnexpectedValueException.php +++ b/src/SprykerEco/Service/AkeneoPim/Dependencies/External/Api/Adapter/HttpClient/Exception/UnexpectedValueException.php @@ -1,9 +1,15 @@ promise->then($onFulfilled, $onRejected), $this->request); + return new self($this->promise->then($onFulfilled, $onRejected), $this->request); } /** @@ -165,7 +165,7 @@ protected function handleGuzzleException(GuzzleException $exception, RequestInte $exception->getMessage(), $exception->getRequest(), $exception->getResponse(), - $exception + $exception, ); } diff --git a/src/SprykerEco/Service/AkeneoPim/Dependencies/External/Api/Adapter/Sdk/AkeneoPimSdkFactory.php b/src/SprykerEco/Service/AkeneoPim/Dependencies/External/Api/Adapter/Sdk/AkeneoPimSdkFactory.php index e43fdc1..2f79ab6 100644 --- a/src/SprykerEco/Service/AkeneoPim/Dependencies/External/Api/Adapter/Sdk/AkeneoPimSdkFactory.php +++ b/src/SprykerEco/Service/AkeneoPim/Dependencies/External/Api/Adapter/Sdk/AkeneoPimSdkFactory.php @@ -9,8 +9,10 @@ use Akeneo\Pim\ApiClient\AkeneoPimClientBuilder; use Akeneo\Pim\ApiClient\AkeneoPimClientInterface; -use Http\Client\HttpClient; +use Akeneo\Pim\ApiClient\Client\ClientInterface as AkeneoClientInterface; +use Psr\Http\Client\ClientInterface; use SprykerEco\Service\AkeneoPim\AkeneoPimConfig; +use SprykerEco\Service\AkeneoPim\Dependencies\External\Api\Adapter\HttpClient\AkeneoHttpClient; use SprykerEco\Service\AkeneoPim\Dependencies\External\Api\Adapter\HttpClient\Client; class AkeneoPimSdkFactory implements AkeneoPimSdkFactoryInterface @@ -23,21 +25,41 @@ class AkeneoPimSdkFactory implements AkeneoPimSdkFactoryInterface public function createAkeneoPimClient(AkeneoPimConfig $config): AkeneoPimClientInterface { $clientBuilder = new AkeneoPimClientBuilder($config->getHost()); - $clientBuilder->setHttpClient($this->createHttpClient()); + $clientBuilder->setHttpClient($this->getHttpClient()); return $clientBuilder->buildAuthenticatedByPassword( $config->getClientId(), $config->getClientSecret(), $config->getUsername(), - $config->getPassword() + $config->getPassword(), ); } /** - * @return \Http\Client\HttpClient + * @return \Psr\Http\Client\ClientInterface */ - protected function createHttpClient(): HttpClient + public function createHttpClient(): ClientInterface { return new Client(); } + + /** + * @return \Akeneo\Pim\ApiClient\Client\ClientInterface + */ + public function createAkeneoHttpClient(): AkeneoClientInterface + { + return new AkeneoHttpClient(); + } + + /** + * @return \Akeneo\Pim\ApiClient\Client\ClientInterface|\Psr\Http\Client\ClientInterface + */ + public function getHttpClient() + { + if (interface_exists('\Akeneo\Pim\ApiClient\Client\ClientInterface')) { + return $this->createAkeneoHttpClient(); + } + + return $this->createHttpClient(); + } } diff --git a/src/SprykerEco/Service/AkeneoPim/Dependencies/External/Api/Wrapper/AkeneoResourceCursor.php b/src/SprykerEco/Service/AkeneoPim/Dependencies/External/Api/Wrapper/AkeneoResourceCursor.php index 581b92b..36aa561 100644 --- a/src/SprykerEco/Service/AkeneoPim/Dependencies/External/Api/Wrapper/AkeneoResourceCursor.php +++ b/src/SprykerEco/Service/AkeneoPim/Dependencies/External/Api/Wrapper/AkeneoResourceCursor.php @@ -40,6 +40,7 @@ public function getPageSize(): int * * @return mixed */ + #[\ReturnTypeWillChange] public function current() { return $this->resourceCursor @@ -62,6 +63,7 @@ public function next(): void * * @return mixed */ + #[\ReturnTypeWillChange] public function key() { return $this->resourceCursor diff --git a/src/SprykerEco/Shared/AkeneoPim/AkeneoPimConstants.php b/src/SprykerEco/Shared/AkeneoPim/AkeneoPimConstants.php index c04b453..c272b73 100644 --- a/src/SprykerEco/Shared/AkeneoPim/AkeneoPimConstants.php +++ b/src/SprykerEco/Shared/AkeneoPim/AkeneoPimConstants.php @@ -12,9 +12,28 @@ */ interface AkeneoPimConstants { + /** + * @var string + */ public const HOST = 'AKENEO_PIM:HOST'; + + /** + * @var string + */ public const USERNAME = 'AKENEO_PIM:USERNAME'; + + /** + * @var string + */ public const PASSWORD = 'AKENEO_PIM:PASSWORD'; + + /** + * @var string + */ public const CLIENT_ID = 'AKENEO_PIM:CLIENT_ID'; + + /** + * @var string + */ public const CLIENT_SECRET = 'AKENEO_PIM:CLIENT_SECRET'; } diff --git a/src/SprykerEco/Shared/AkeneoPim/Transfer/akeneo-pim.transfer.xml b/src/SprykerEco/Shared/AkeneoPim/Transfer/akeneo_pim.transfer.xml similarity index 100% rename from src/SprykerEco/Shared/AkeneoPim/Transfer/akeneo-pim.transfer.xml rename to src/SprykerEco/Shared/AkeneoPim/Transfer/akeneo_pim.transfer.xml diff --git a/tests/SprykerEcoTest/Service/AkeneoPim/_support/AkeneoPimServiceTester.php b/tests/SprykerEcoTest/Service/AkeneoPim/_support/AkeneoPimServiceTester.php index 679e08f..f873e72 100644 --- a/tests/SprykerEcoTest/Service/AkeneoPim/_support/AkeneoPimServiceTester.php +++ b/tests/SprykerEcoTest/Service/AkeneoPim/_support/AkeneoPimServiceTester.php @@ -1,11 +1,17 @@ Date: Thu, 21 Mar 2024 16:37:49 +0100 Subject: [PATCH 3/8] CC-33265: Updated the PHP version and CI scripts. --- composer.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 5f3b3d7..bdc5c41 100644 --- a/composer.json +++ b/composer.json @@ -5,7 +5,7 @@ "license": "proprietary", "require": { "akeneo/api-php-client": "^1.0.0 || ^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0", - "php": ">=7.2", + "php": ">=8.1", "php-http/httplug": "^1.0.0 || ^2.0.0", "php-http/promise": "^1.0.0", "psr/http-client": "^1.0.0", @@ -31,7 +31,9 @@ "prefer-stable": true, "scripts": { "cs-check": "phpcs -p -s --standard=vendor/spryker/code-sniffer/Spryker/ruleset.xml src/ tests/", - "cs-fix": "phpcbf -p --standard=vendor/spryker/code-sniffer/Spryker/ruleset.xml src/ tests/" + "cs-fix": "phpcbf -p --standard=vendor/spryker/code-sniffer/Spryker/ruleset.xml src/ tests/", + "stan": "phpstan analyse -c phpstan.neon -l 8 src/", + "stan-setup": "cp composer.json composer.backup && COMPOSER_MEMORY_LIMIT=-1 composer require --dev phpstan/phpstan:^0.12 && mv composer.backup composer.json" }, "extra": { "branch-alias": { From b62db3789c80a5b3595e2d9c984d907bf452b25c Mon Sep 17 00:00:00 2001 From: Denys Sokolov Date: Thu, 21 Mar 2024 16:45:51 +0100 Subject: [PATCH 4/8] CC-33265: Updated the PHP version in the README file. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ec87a85..f9a8d63 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [![Build Status](https://scrutinizer-ci.com/g/spryker-eco/akeneo-pim/badges/build.png?b=master)](https://scrutinizer-ci.com/g/spryker-eco/akeneo-pim/build-status/master) [![Latest Stable Version](https://poser.pugx.org/spryker-eco/akeneo-pim/v/stable.svg)](https://packagist.org/packages/spryker-eco/akeneo-pim) [![License](https://img.shields.io/github/license/spryker-eco/akeneo-pim.svg?b=master)](https://github.com/spryker-eco/akeneo-pim) -[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%207.2-8892BF.svg)](https://php.net/) +[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%208.1-8892BF.svg)](https://php.net/) ## Installation From 2d8fb16dd3e88b9d4dda56818b2cf9f9a3a8f900 Mon Sep 17 00:00:00 2001 From: Denys Sokolov Date: Thu, 21 Mar 2024 16:51:02 +0100 Subject: [PATCH 5/8] CC-33265: Updated the PHP version in the CI file. --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 412ac4b..5586612 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,7 +50,7 @@ jobs: fail-fast: false matrix: php-versions: - - '7.2' + - '8.1' - '8.2' services: @@ -107,7 +107,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '7.2' + php-version: '8.1' extensions: mbstring, intl, bcmath, pdo_mysql - name: Composer Install From 258a1a9e337a562442ee25b51af4ae17ed689fa3 Mon Sep 17 00:00:00 2001 From: Denys Sokolov Date: Thu, 21 Mar 2024 17:18:11 +0100 Subject: [PATCH 6/8] CC-33265: Update the Scrutinizer CI configuration. --- .scrutinizer.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.scrutinizer.yml b/.scrutinizer.yml index b32755f..5da4960 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -1,10 +1,13 @@ build: environment: - php: '7.2' + php: '8.1' tests: override: - true + dependencies: + override: + - composer self-update nodes: analysis: From f034554977e8e839fc9406a34fdc21f29f9c7a79 Mon Sep 17 00:00:00 2001 From: Denys Sokolov Date: Thu, 21 Mar 2024 17:49:22 +0100 Subject: [PATCH 7/8] CC-33265: Added the phpstan to dev dependencies. --- composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/composer.json b/composer.json index bdc5c41..44f4fd8 100644 --- a/composer.json +++ b/composer.json @@ -14,6 +14,7 @@ "spryker/kernel": "^3.30.0" }, "require-dev": { + "phpstan/phpstan": "^1.0.0", "spryker/code-sniffer": "*", "spryker/testify": "*" }, From 8c673020e6126fbaab566f7a2208946400951af5 Mon Sep 17 00:00:00 2001 From: Denys Sokolov Date: Fri, 22 Mar 2024 13:01:54 +0100 Subject: [PATCH 8/8] CC-33265: Updated the metafiles. --- .gitattributes | 5 +- .github/workflows/ci.yml | 110 +++--------------- .gitignore | 35 +++++- README.md | 4 +- .../Exception/UnexpectedValueException.php | 4 +- 5 files changed, 55 insertions(+), 103 deletions(-) diff --git a/.gitattributes b/.gitattributes index e0b3e87..51f3ea4 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2,6 +2,8 @@ # Set the default behavior, in case people don't have core.autocrlf set. * text text=auto eol=lf +*.php diff=php + # Denote all files that are truly binary and should not be modified. *.png binary *.jpg binary @@ -20,7 +22,6 @@ *.exe binary # Remove files for archives generated using `git archive` -architecture-baseline.json export-ignore dependency.json export-ignore phpstan.json export-ignore phpstan.neon export-ignore @@ -31,3 +32,5 @@ tooling.yml export-ignore .editorconfig export-ignore .gitattributes export-ignore .gitignore export-ignore +.github/ export-ignore +architecture-baseline.json export-ignore diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5586612..e851193 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,126 +1,52 @@ name: CI -env: - APPLICATION_ENV: 'development' - APPLICATION_STORE: 'DE' - PROJECT: 'Akeneo PIM' - DATABASE_VERSION: 10.2 - DATABASE_HOST: 127.0.0.1 - DATABASE_PORT: 3306 - DATABASE_NAME: eu-docker - DATABASE_USERNAME: root - DATABASE_PASSWORD: secret - DATABASE_ROOT_PASSWORD: secret - DATABASE_ALLOW_EMPTY_PASSWORD: false - DATABASE_CHARACTER_SET: utf8 - DATABASE_COLLATE: utf8_general_ci - on: - pull_request: push: branches: - 'master' + pull_request: workflow_dispatch: jobs: - setup: - name: Setup Database MariaDB - runs-on: ubuntu-22.04 - - steps: - - uses: actions/checkout@v2 - - uses: getong/mariadb-action@v1.1 - with: - host port: ${{ env.DATABASE_PORT }} - container port: ${{ env.DATABASE_PORT }} - character set server: ${{ env.DATABASE_CHARACTER_SET }} - collation server: ${{ env.DATABASE_COLLATE }} - mariadb version: ${{ env.DATABASE_VERSION }} - mysql database: ${{ env.DATABASE_NAME }} - mysql root password: ${{ env.DATABASE_ROOT_PASSWORD }} - mysql user: ${{ env.DATABASE_USERNAME }} - mysql password: ${{ env.DATABASE_PASSWORD }} - - ci: - name: Akeneo PIM (PHP ${{ matrix.php-versions }}) - needs: setup - runs-on: ubuntu-22.04 - - strategy: - fail-fast: false - matrix: - php-versions: - - '8.1' - - '8.2' - - services: - mariadb: - image: mariadb:10.2 - env: - MYSQL_ALLOW_EMPTY_PASSWORD: false - MYSQL_ROOT_PASSWORD: secret - MYSQL_DATABASE: eu-docker - ports: - - 3306:3306 - options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + validation: + name: Validation + runs-on: ubuntu-latest steps: - - name: Checkout@v2 - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - - name: Setup PHP ${{ matrix.php-versions }} + - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: ${{ matrix.php-versions }} - extensions: mbstring, intl, bcmath, pdo_mysql + php-version: '8.2' + extensions: mbstring, intl, bcmath + coverage: none - - name: Get composer cache directory - id: composer-cache - run: | - echo "::set-output name=dir::$(composer config cache-files-dir)" - - uses: actions/cache@v2 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-${{ matrix.php-versions }}-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: ${{ runner.os }}-${{ matrix.php-versions }}-composer- + - name: Composer Install + run: composer install --prefer-dist --no-interaction --profile - - name: Composer validate + - name: Run validation run: composer validate - - name: Composer version - run: composer --version - - - name: Composer install - run: composer install --prefer-dist --no-interaction --optimize-autoloader - - - name: PHP syntax validation + - name: Syntax check run: find ./src -path src -prune -o -type f -name '*.php' -print0 | xargs -0 -n1 -P4 php -l -n | (! grep -v "No syntax errors detected" ) lowest: - name: Akeneo PIM Prefer Lowest (PHP ${{ matrix.php-versions }}) - runs-on: ubuntu-22.04 + name: Prefer Lowest + runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: '8.1' - extensions: mbstring, intl, bcmath, pdo_mysql + extensions: mbstring, intl, bcmath + coverage: none - name: Composer Install run: composer install --prefer-dist --no-interaction --profile - name: Composer Update run: composer update --prefer-lowest --prefer-dist --no-interaction --profile -vvv - - - name: Prefer lowest installation - run: composer require --dev dereuromark/composer-prefer-lowest; - - - name: PHP syntax validation - run: find ./src -path src -prune -o -type f -name '*.php' -print0 | xargs -0 -n1 -P4 php -l -n | (! grep -v "No syntax errors detected" ) - - - name: Prefer lowest validation - run: vendor/bin/validate-prefer-lowest -m diff --git a/.gitignore b/.gitignore index 6633a49..58b3e11 100644 --- a/.gitignore +++ b/.gitignore @@ -1,13 +1,36 @@ -# IDEs -/.idea -/.project -/nbproject -/.buildpath -/.settings +# IDE +.idea/ +.project/ +nbproject/ +.buildpath/ +.settings/ *.sublime-* + +# OS +.DS_Store *.AppleDouble *.AppleDB *.AppleDesktop +# grunt stuff +.grunt +.sass-cache +/node_modules/ + +# tooling vendor/ composer.lock +.phpunit.result.cache + +# built client resources +src/*/Zed/*/Static/Public +src/*/Zed/*/Static/Assets/sprite + +# Propel classes +src/*/Zed/*/Persistence/Propel/Base/* +src/*/Zed/*/Persistence/Propel/Map/* + +# tests +tests/**/_generated/ +tests/_output/* +!tests/_output/.gitkeep diff --git a/README.md b/README.md index f9a8d63..f78e4ff 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # AkeneoPim Module [![CI](https://github.com/spryker-eco/akeneo-pim/actions/workflows/ci.yml/badge.svg)](https://github.com/spryker-eco/akeneo-pim/actions/workflows/ci.yml) -[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/spryker-eco/akeneo-pim/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/spryker-eco/akeneo-pim/?branch=master) -[![Build Status](https://scrutinizer-ci.com/g/spryker-eco/akeneo-pim/badges/build.png?b=master)](https://scrutinizer-ci.com/g/spryker-eco/akeneo-pim/build-status/master) + +[![CI](https://scrutinizer-ci.com/g/spryker-eco/akeneo-pim/badges/build.png?b=master)](https://scrutinizer-ci.com/g/spryker-eco/akeneo-pim/build-status/master) [![Latest Stable Version](https://poser.pugx.org/spryker-eco/akeneo-pim/v/stable.svg)](https://packagist.org/packages/spryker-eco/akeneo-pim) [![License](https://img.shields.io/github/license/spryker-eco/akeneo-pim.svg?b=master)](https://github.com/spryker-eco/akeneo-pim) [![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%208.1-8892BF.svg)](https://php.net/) diff --git a/src/SprykerEco/Service/AkeneoPim/Dependencies/External/Api/Adapter/HttpClient/Exception/UnexpectedValueException.php b/src/SprykerEco/Service/AkeneoPim/Dependencies/External/Api/Adapter/HttpClient/Exception/UnexpectedValueException.php index c9cab3d..5045c55 100644 --- a/src/SprykerEco/Service/AkeneoPim/Dependencies/External/Api/Adapter/HttpClient/Exception/UnexpectedValueException.php +++ b/src/SprykerEco/Service/AkeneoPim/Dependencies/External/Api/Adapter/HttpClient/Exception/UnexpectedValueException.php @@ -8,8 +8,8 @@ namespace SprykerEco\Service\AkeneoPim\Dependencies\External\Api\Adapter\HttpClient\Exception; use Http\Client\Exception; -use UnexpectedValueException as UnexpectedValueExceptionUnexpectedValueException; +use UnexpectedValueException as SplUnexpectedValueException; -class UnexpectedValueException extends UnexpectedValueExceptionUnexpectedValueException implements Exception +class UnexpectedValueException extends SplUnexpectedValueException implements Exception { }