From 6371411aa4e064a563f9e4193a6b503bac6e36fb Mon Sep 17 00:00:00 2001 From: Rafikooo Date: Tue, 16 May 2023 19:13:38 +0200 Subject: [PATCH 01/18] [Maintenance] Support Sylius 1.13.x-dev --- composer.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/composer.json b/composer.json index 5aa9aa60..4ee09345 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,11 @@ "phpseclib/phpseclib": "^2.0", "polishsymfonycommunity/symfony-mocker-container": "^1.0", "sylius-labs/doctrine-migrations-extra-bundle": "^0.1.4 || ^0.2", +<<<<<<< Updated upstream "sylius/sylius": "~1.11.0 || ~1.12.0", +======= + "sylius/sylius": "~1.12.0 || 1.13.x-dev", +>>>>>>> Stashed changes "symfony/mailer": "^5.4 || ^6.0" }, "require-dev": { From ba273a0169733a844822b2759b2b335d7dde4aab Mon Sep 17 00:00:00 2001 From: Rafikooo Date: Wed, 17 May 2023 08:33:24 +0200 Subject: [PATCH 02/18] Revert "[Maintenance] Support Sylius 1.13.x-dev" This reverts commit 6371411aa4e064a563f9e4193a6b503bac6e36fb. --- composer.json | 4 ---- 1 file changed, 4 deletions(-) diff --git a/composer.json b/composer.json index 4ee09345..5aa9aa60 100644 --- a/composer.json +++ b/composer.json @@ -10,11 +10,7 @@ "phpseclib/phpseclib": "^2.0", "polishsymfonycommunity/symfony-mocker-container": "^1.0", "sylius-labs/doctrine-migrations-extra-bundle": "^0.1.4 || ^0.2", -<<<<<<< Updated upstream "sylius/sylius": "~1.11.0 || ~1.12.0", -======= - "sylius/sylius": "~1.12.0 || 1.13.x-dev", ->>>>>>> Stashed changes "symfony/mailer": "^5.4 || ^6.0" }, "require-dev": { From 200f9679cfcc2693b059ad8aca3d7b4d66439fe7 Mon Sep 17 00:00:00 2001 From: Ezar Affandi Date: Sat, 4 Jun 2022 23:44:10 +0400 Subject: [PATCH 03/18] fix: no extension able to load the configuration for 'sylius_pay_pal_plugin' instead 'sylius_pay_pal' --- docs/sandbox-vs-live.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sandbox-vs-live.md b/docs/sandbox-vs-live.md index 13692377..c03336e4 100644 --- a/docs/sandbox-vs-live.md +++ b/docs/sandbox-vs-live.md @@ -4,7 +4,7 @@ By default, plugin operates in the sandbox mode. I means all the transactions wo To change it, you need to configure the plugin properly: ```yaml -sylius_pay_pal_plugin: +sylius_pay_pal: sandbox: false ``` From 1f9f625948d038482ad016425036ac250ff7640b Mon Sep 17 00:00:00 2001 From: Rafikooo Date: Wed, 17 May 2023 08:46:17 +0200 Subject: [PATCH 04/18] Resolve conflicts --- composer.json | 1 - 1 file changed, 1 deletion(-) diff --git a/composer.json b/composer.json index 5aa9aa60..b763509c 100644 --- a/composer.json +++ b/composer.json @@ -44,7 +44,6 @@ }, "conflict": { "doctrine/doctrine-bundle": "2.3.0", - "doctrine/dbal": "^3.0.0", "sylius/invoicing-plugin": "<0.16.0" }, "autoload": { From 41dc711137c0e91ef8c1706b20d438aa369a8db9 Mon Sep 17 00:00:00 2001 From: Mateusz Zalewski Date: Wed, 2 Nov 2022 13:42:15 +0100 Subject: [PATCH 05/18] Mention 1.5 branch in README --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index dfd715ed..fe5385fd 100644 --- a/README.md +++ b/README.md @@ -48,5 +48,6 @@ Sylius Core Team’s plugin for [PayPal Commerce Platform](https://www.paypal.co #### Supported branches * `1.3` (v1.3.*) - security fixes -* `1.4` (v1.4.*) - bug fixes, improvements -* `master` (v1.5.*) - new features +* `1.4` (v1.4.*) - bug fixes +* `1.5` (v1.5.*) - bug fixes, improvements +* `master` (v1.6.*) - new features From 0c3441524fad48efee22a3009cb3cad6a3a5aea0 Mon Sep 17 00:00:00 2001 From: Mateusz Zalewski Date: Wed, 2 Nov 2022 13:43:00 +0100 Subject: [PATCH 06/18] Mention 1.5 branch in PR template --- .github/PULL_REQUEST_TEMPLATE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index e2ffa087..3cc44512 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,6 +1,6 @@ | Q | A | --------------- | ----- -| Branch? | 1.3 (security fixes), 1.4 (bug fixes, improvements), master (new features) +| Branch? | 1.3 (security fixes), 1.4 or 1.5 (bug fixes, improvements), master (new features) | Bug fix? | no/yes | New feature? | no/yes | Related tickets | fixes #X, partially #Y, mentioned in #Z From 7f2c9a9cb4b9b791835956ec88fb6b038c7e9165 Mon Sep 17 00:00:00 2001 From: Rafikooo Date: Wed, 17 May 2023 08:46:56 +0200 Subject: [PATCH 07/18] Drop Sylius 1.11 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index b763509c..14266d91 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ "phpseclib/phpseclib": "^2.0", "polishsymfonycommunity/symfony-mocker-container": "^1.0", "sylius-labs/doctrine-migrations-extra-bundle": "^0.1.4 || ^0.2", - "sylius/sylius": "~1.11.0 || ~1.12.0", + "sylius/sylius": "~1.12.0", "symfony/mailer": "^5.4 || ^6.0" }, "require-dev": { From bc1cae8f18420842e12006ed223d72b82eb368b7 Mon Sep 17 00:00:00 2001 From: Rafikooo Date: Fri, 7 Apr 2023 14:49:18 +0200 Subject: [PATCH 08/18] [Maintenance] Add new SYLIUS_MESSENGER envs --- tests/Application/.env | 6 ++++++ tests/Application/.env.test | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/tests/Application/.env b/tests/Application/.env index b7c019cd..c8c681a9 100644 --- a/tests/Application/.env +++ b/tests/Application/.env @@ -22,7 +22,13 @@ DATABASE_URL=mysql://root@127.0.0.1/sylius_pay_pal_plugin_%kernel.environment% MAILER_URL=smtp://localhost ###< symfony/swiftmailer-bundle ### +###> symfony/messenger ### MESSENGER_TRANSPORT_DSN=doctrine://default +SYLIUS_MESSENGER_TRANSPORT_MAIN_DSN=doctrine://default +SYLIUS_MESSENGER_TRANSPORT_MAIN_FAILED_DSN=doctrine://default?queue_name=main_failed +SYLIUS_MESSENGER_TRANSPORT_CATALOG_PROMOTION_REMOVAL_DSN=doctrine://default?queue_name=catalog_promotion_removal +SYLIUS_MESSENGER_TRANSPORT_CATALOG_PROMOTION_REMOVAL_FAILED_DSN=doctrine://default?queue_name=catalog_promotion_removal_failed +###< symfony/messenger ### ###> symfony/mailer ### MAILER_DSN=null://null diff --git a/tests/Application/.env.test b/tests/Application/.env.test index 86f84732..24a84d6d 100644 --- a/tests/Application/.env.test +++ b/tests/Application/.env.test @@ -4,4 +4,11 @@ KERNEL_CLASS='Tests\Sylius\PayPalPlugin\Application\Kernel' TEST_CLIENT_ID='AWKG4oiWX9AOifqtdkbOTgSgi3MqcaiyAt-x9Pa35lDdW94kjrOEqN-n3NQ4hD2TuomgpiDc27snMKd9' +###> symfony/messenger ### +# Sync transport turned for testing env for the ease of testing MESSENGER_TRANSPORT_DSN=sync:// +SYLIUS_MESSENGER_TRANSPORT_MAIN_DSN=sync:// +SYLIUS_MESSENGER_TRANSPORT_MAIN_FAILED_DSN=sync:// +SYLIUS_MESSENGER_TRANSPORT_CATALOG_PROMOTION_REMOVAL_DSN=sync:// +SYLIUS_MESSENGER_TRANSPORT_CATALOG_PROMOTION_REMOVAL_FAILED_DSN=sync:// +###< symfony/messenger ### From 079141f1328af63461361307828fd1717a3ed90b Mon Sep 17 00:00:00 2001 From: Rafikooo Date: Tue, 11 Apr 2023 14:42:42 +0200 Subject: [PATCH 09/18] [CI] Remove Sylius 1.11 from jobs --- .github/workflows/build.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8fa0a406..faa073c6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,11 +23,7 @@ jobs: node: ["16.x"] mysql: ["5.7", "8.0"] symfony: ["^5.4", "^6.0"] - sylius: ["~1.11.0", "~1.12.0"] - exclude: - - - symfony: "^6.0" - sylius: "~1.11.0" + sylius: ["~1.12.0"] env: APP_ENV: test DATABASE_URL: "mysql://root:root@127.0.0.1/sylius?serverVersion=${{ matrix.mysql }}" From b541d284f9e0222f37e0ac50bd2db30509452a64 Mon Sep 17 00:00:00 2001 From: Rafikooo Date: Tue, 11 Apr 2023 14:57:27 +0200 Subject: [PATCH 10/18] [Maintenance] Fix psalm errors --- src/Controller/CancelPayPalCheckoutPaymentAction.php | 2 +- src/Controller/CancelPayPalOrderAction.php | 2 +- src/Controller/CancelPayPalPaymentAction.php | 2 +- src/Controller/PayPalPaymentOnErrorAction.php | 2 +- src/Controller/Webhook/RefundOrderAction.php | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Controller/CancelPayPalCheckoutPaymentAction.php b/src/Controller/CancelPayPalCheckoutPaymentAction.php index ad53d03d..c4c45100 100644 --- a/src/Controller/CancelPayPalCheckoutPaymentAction.php +++ b/src/Controller/CancelPayPalCheckoutPaymentAction.php @@ -26,7 +26,7 @@ public function __construct( public function __invoke(Request $request): Response { - $content = (array) json_decode((string) $request->getContent(false), true); + $content = (array) json_decode($request->getContent(), true); $payment = $this->paymentProvider->getByPayPalOrderId((string) $content['payPalOrderId']); diff --git a/src/Controller/CancelPayPalOrderAction.php b/src/Controller/CancelPayPalOrderAction.php index a2c1dcd1..e107bc37 100644 --- a/src/Controller/CancelPayPalOrderAction.php +++ b/src/Controller/CancelPayPalOrderAction.php @@ -37,7 +37,7 @@ public function __construct( public function __invoke(Request $request): Response { - $content = (array) json_decode((string) $request->getContent(false), true); + $content = (array) json_decode($request->getContent(), true); $payment = $this->paymentProvider->getByPayPalOrderId((string) $content['payPalOrderId']); diff --git a/src/Controller/CancelPayPalPaymentAction.php b/src/Controller/CancelPayPalPaymentAction.php index 125f043b..6de4ac1c 100644 --- a/src/Controller/CancelPayPalPaymentAction.php +++ b/src/Controller/CancelPayPalPaymentAction.php @@ -48,7 +48,7 @@ public function __construct( public function __invoke(Request $request): Response { - $content = (array) json_decode((string) $request->getContent(false), true); + $content = (array) json_decode($request->getContent(), true); $payment = $this->paymentProvider->getByPayPalOrderId((string) $content['payPalOrderId']); diff --git a/src/Controller/PayPalPaymentOnErrorAction.php b/src/Controller/PayPalPaymentOnErrorAction.php index c3ddb52b..63eb2497 100644 --- a/src/Controller/PayPalPaymentOnErrorAction.php +++ b/src/Controller/PayPalPaymentOnErrorAction.php @@ -29,7 +29,7 @@ public function __construct(FlashBagInterface|RequestStack $flashBagOrRequestSta public function __invoke(Request $request): Response { - $this->logger->error((string) $request->getContent()); + $this->logger->error($request->getContent()); FlashBagProvider::getFlashBag($this->flashBagOrRequestStack) ->add('error', 'sylius.pay_pal.something_went_wrong') ; diff --git a/src/Controller/Webhook/RefundOrderAction.php b/src/Controller/Webhook/RefundOrderAction.php index 67e9d465..986b55e1 100644 --- a/src/Controller/Webhook/RefundOrderAction.php +++ b/src/Controller/Webhook/RefundOrderAction.php @@ -62,7 +62,7 @@ public function __invoke(Request $request): Response private function getPayPalPaymentUrl(Request $request): string { - $content = (array) json_decode((string) $request->getContent(false), true); + $content = (array) json_decode($request->getContent(), true); Assert::keyExists($content, 'resource'); $resource = (array) $content['resource']; Assert::keyExists($resource, 'links'); From 6ec2ce89d81e9d8f71fe73832ddfbdcafab1a8ae Mon Sep 17 00:00:00 2001 From: Rafikooo Date: Tue, 11 Apr 2023 15:02:34 +0200 Subject: [PATCH 11/18] [Migration] Extend AbstractMigration from SyliusCoreBundle --- src/Migrations/Version20200907102535.php | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/Migrations/Version20200907102535.php b/src/Migrations/Version20200907102535.php index b6120e80..55428440 100644 --- a/src/Migrations/Version20200907102535.php +++ b/src/Migrations/Version20200907102535.php @@ -5,32 +5,23 @@ namespace Sylius\PayPalPlugin\Migrations; use Doctrine\DBAL\Schema\Schema; -use Doctrine\Migrations\AbstractMigration; +use Sylius\Bundle\CoreBundle\Doctrine\Migrations\AbstractMigration as SyliusAbstractMigration; -/** - * Auto-generated Migration: Please modify to your needs! - */ -final class Version20200907102535 extends AbstractMigration +final class Version20200907102535 extends SyliusAbstractMigration { public function getDescription(): string { - return ''; + return 'Add PayPalCredentials table'; } public function up(Schema $schema): void { - // this up() migration is auto-generated, please modify it to your needs - $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); - $this->addSql('CREATE TABLE sylius_paypal_plugin_pay_pal_credentials (id VARCHAR(255) NOT NULL, payment_method_id INT DEFAULT NULL, access_token VARCHAR(255) NOT NULL, creation_time DATETIME NOT NULL, expiration_time DATETIME NOT NULL, INDEX IDX_C56F54AD5AA1164F (payment_method_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET UTF8 COLLATE `UTF8_unicode_ci` ENGINE = InnoDB'); $this->addSql('ALTER TABLE sylius_paypal_plugin_pay_pal_credentials ADD CONSTRAINT FK_C56F54AD5AA1164F FOREIGN KEY (payment_method_id) REFERENCES sylius_payment_method (id)'); } public function down(Schema $schema): void { - // this down() migration is auto-generated, please modify it to your needs - $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); - $this->addSql('DROP TABLE sylius_paypal_plugin_pay_pal_credentials'); } } From 8c38488cb5ceefa76fc52c18419f82839c131743 Mon Sep 17 00:00:00 2001 From: Rafikooo Date: Tue, 11 Apr 2023 15:07:24 +0200 Subject: [PATCH 12/18] [Psalm] Ignore Symfony\Component\Security\Core\Security class deprecation alert --- psalm.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/psalm.xml b/psalm.xml index d8968a42..2f848c6f 100644 --- a/psalm.xml +++ b/psalm.xml @@ -23,6 +23,12 @@ + + + + + + From 71aae04f67d136c3a19505c3c8e5ea3dafae361e Mon Sep 17 00:00:00 2001 From: Rafikooo Date: Tue, 11 Apr 2023 16:13:03 +0200 Subject: [PATCH 13/18] [PHPStan] Bump to stable ^1.6 package version --- composer.json | 16 ++++++++-------- phpstan.neon => phpstan.neon.dist | 2 ++ src/UrlUtils.php | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) rename phpstan.neon => phpstan.neon.dist (98%) diff --git a/composer.json b/composer.json index 14266d91..83ffaeda 100644 --- a/composer.json +++ b/composer.json @@ -26,21 +26,21 @@ "friends-of-behat/suite-settings-extension": "^1.0", "friends-of-behat/symfony-extension": "^2.1", "friends-of-behat/variadic-extension": "^1.3", + "lchrusciel/api-test-case": "^5.1", "phpspec/phpspec": "^7.0", - "phpstan/phpstan": "0.12.98", - "phpstan/phpstan-doctrine": "0.12.33", - "phpstan/phpstan-webmozart-assert": "0.12.12", + "phpstan/phpstan": "^1.6", + "phpstan/phpstan-doctrine": "1.3.37", + "phpstan/phpstan-webmozart-assert": "^1.1", "phpunit/phpunit": "^8.5", "sylius-labs/coding-standard": "^4.0", + "sylius/sylius-rector": "0.11.x-dev", "symfony/browser-kit": "^5.4 || ^6.0", "symfony/debug-bundle": "^5.4 || ^6.0", "symfony/dotenv": "^5.4 || ^6.0", "symfony/intl": "^5.4 || ^6.0", "symfony/web-profiler-bundle": "^5.4 || ^6.0", - "vimeo/psalm": "4.27.0", - "rector/rector": "^0.11.53", - "lchrusciel/api-test-case": "^5.1", - "symfony/webpack-encore-bundle": "^1.15" + "symfony/webpack-encore-bundle": "^1.15", + "vimeo/psalm": "4.27.0" }, "conflict": { "doctrine/doctrine-bundle": "2.3.0", @@ -72,7 +72,7 @@ "scripts": { "analyse": [ "@composer validate --strict", - "vendor/bin/phpstan.phar analyse -c phpstan.neon -l max src/", + "vendor/bin/phpstan.phar analyse -c phpstan.neon.dist -l max src/", "vendor/bin/psalm" ], "fix": [ diff --git a/phpstan.neon b/phpstan.neon.dist similarity index 98% rename from phpstan.neon rename to phpstan.neon.dist index 4492da04..9b4bc47f 100644 --- a/phpstan.neon +++ b/phpstan.neon.dist @@ -3,6 +3,8 @@ includes: - vendor/phpstan/phpstan-webmozart-assert/extension.neon parameters: + level: 3 + reportUnmatchedIgnoredErrors: false checkMissingIterableValueType: false checkGenericClassInNonGenericObjectType: false diff --git a/src/UrlUtils.php b/src/UrlUtils.php index dceb49fe..f4041879 100644 --- a/src/UrlUtils.php +++ b/src/UrlUtils.php @@ -28,7 +28,7 @@ private function __construct() * * @return string the resulting string */ - public static function appendQueryString(string $url, string $queryString, int $mode = APPEND_QUERY_STRING_IGNORE_DUPLICATE): string + public static function appendQueryString(string $url, string $queryString, int $mode = self::APPEND_QUERY_STRING_IGNORE_DUPLICATE): string { if ('' === $queryString) { return $url; From 06f49d5460eef6e4bab025d146166b71252864b9 Mon Sep 17 00:00:00 2001 From: Rafikooo Date: Tue, 11 Apr 2023 16:20:18 +0200 Subject: [PATCH 14/18] [ECS] Update config file --- ecs.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ecs.php b/ecs.php index 625ca542..40c669c9 100644 --- a/ecs.php +++ b/ecs.php @@ -3,12 +3,13 @@ use PhpCsFixer\Fixer\ClassNotation\VisibilityRequiredFixer; use SlevomatCodingStandard\Sniffs\Commenting\InlineDocCommentDeclarationSniff; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; +use Symplify\EasyCodingStandard\Config\ECSConfig; use Symplify\EasyCodingStandard\ValueObject\Option; -return static function (ContainerConfigurator $containerConfigurator): void { - $containerConfigurator->import('vendor/sylius-labs/coding-standard/ecs.php'); +return static function (ECSConfig $config): void { + $config->import('vendor/sylius-labs/coding-standard/ecs.php'); - $containerConfigurator->parameters()->set(Option::SKIP, [ + $config->skip([ VisibilityRequiredFixer::class => ['*Spec.php'], InlineDocCommentDeclarationSniff::class . '.MissingVariable', ]); From 9701c3c54edbd4536e2411deb33f4b4b400e6553 Mon Sep 17 00:00:00 2001 From: Rafikooo Date: Fri, 14 Apr 2023 11:40:43 +0200 Subject: [PATCH 15/18] [Psalm] Suppress UnnecesaryVarAnnotation and UndefinedDocblockClass errors --- psalm.xml | 6 ++++++ src/Controller/CancelPayPalCheckoutPaymentAction.php | 8 +++++++- src/Controller/CancelPayPalOrderAction.php | 8 +++++++- src/Controller/CancelPayPalPaymentAction.php | 8 +++++++- src/Controller/PayPalPaymentOnErrorAction.php | 8 +++++++- src/Controller/Webhook/RefundOrderAction.php | 8 +++++++- 6 files changed, 41 insertions(+), 5 deletions(-) diff --git a/psalm.xml b/psalm.xml index 2f848c6f..5b990dc2 100644 --- a/psalm.xml +++ b/psalm.xml @@ -17,6 +17,12 @@ + + + + + + diff --git a/src/Controller/CancelPayPalCheckoutPaymentAction.php b/src/Controller/CancelPayPalCheckoutPaymentAction.php index c4c45100..0020c599 100644 --- a/src/Controller/CancelPayPalCheckoutPaymentAction.php +++ b/src/Controller/CancelPayPalCheckoutPaymentAction.php @@ -26,7 +26,13 @@ public function __construct( public function __invoke(Request $request): Response { - $content = (array) json_decode($request->getContent(), true); + /** + * @var string $content + * @psalm-suppress UnnecessaryVarAnnotation + */ + $content = $request->getContent(); + + $content = (array) json_decode($content, true); $payment = $this->paymentProvider->getByPayPalOrderId((string) $content['payPalOrderId']); diff --git a/src/Controller/CancelPayPalOrderAction.php b/src/Controller/CancelPayPalOrderAction.php index e107bc37..ea5d15bc 100644 --- a/src/Controller/CancelPayPalOrderAction.php +++ b/src/Controller/CancelPayPalOrderAction.php @@ -37,7 +37,13 @@ public function __construct( public function __invoke(Request $request): Response { - $content = (array) json_decode($request->getContent(), true); + /** + * @var string $content + * @psalm-suppress UnnecessaryVarAnnotation + */ + $content = $request->getContent(); + + $content = (array) json_decode($content, true); $payment = $this->paymentProvider->getByPayPalOrderId((string) $content['payPalOrderId']); diff --git a/src/Controller/CancelPayPalPaymentAction.php b/src/Controller/CancelPayPalPaymentAction.php index 6de4ac1c..33c407e8 100644 --- a/src/Controller/CancelPayPalPaymentAction.php +++ b/src/Controller/CancelPayPalPaymentAction.php @@ -48,7 +48,13 @@ public function __construct( public function __invoke(Request $request): Response { - $content = (array) json_decode($request->getContent(), true); + /** + * @var string $content + * @psalm-suppress UnnecessaryVarAnnotation + */ + $content = $request->getContent(); + + $content = (array) json_decode($content, true); $payment = $this->paymentProvider->getByPayPalOrderId((string) $content['payPalOrderId']); diff --git a/src/Controller/PayPalPaymentOnErrorAction.php b/src/Controller/PayPalPaymentOnErrorAction.php index 63eb2497..9c218499 100644 --- a/src/Controller/PayPalPaymentOnErrorAction.php +++ b/src/Controller/PayPalPaymentOnErrorAction.php @@ -29,7 +29,13 @@ public function __construct(FlashBagInterface|RequestStack $flashBagOrRequestSta public function __invoke(Request $request): Response { - $this->logger->error($request->getContent()); + /** + * @var string $content + * @psalm-suppress UnnecessaryVarAnnotation + */ + $content = $request->getContent(); + + $this->logger->error($content); FlashBagProvider::getFlashBag($this->flashBagOrRequestStack) ->add('error', 'sylius.pay_pal.something_went_wrong') ; diff --git a/src/Controller/Webhook/RefundOrderAction.php b/src/Controller/Webhook/RefundOrderAction.php index 986b55e1..0c9bc9aa 100644 --- a/src/Controller/Webhook/RefundOrderAction.php +++ b/src/Controller/Webhook/RefundOrderAction.php @@ -62,7 +62,13 @@ public function __invoke(Request $request): Response private function getPayPalPaymentUrl(Request $request): string { - $content = (array) json_decode($request->getContent(), true); + /** + * @var string $content + * @psalm-suppress UnnecessaryVarAnnotation + */ + $content = $request->getContent(); + + $content = (array) json_decode($content, true); Assert::keyExists($content, 'resource'); $resource = (array) $content['resource']; Assert::keyExists($resource, 'links'); From 70315102327649be21c1f1fa1a50f90d4983cf6b Mon Sep 17 00:00:00 2001 From: Rafikooo Date: Fri, 14 Apr 2023 13:12:59 +0200 Subject: [PATCH 16/18] [CI][PHPStan] Use level from the configuration file --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 83ffaeda..a725b400 100644 --- a/composer.json +++ b/composer.json @@ -72,7 +72,7 @@ "scripts": { "analyse": [ "@composer validate --strict", - "vendor/bin/phpstan.phar analyse -c phpstan.neon.dist -l max src/", + "vendor/bin/phpstan.phar analyse", "vendor/bin/psalm" ], "fix": [ From 6caea43cd0778a957ea32b1d05cbdcf4069824fb Mon Sep 17 00:00:00 2001 From: Rafikooo Date: Tue, 25 Apr 2023 10:31:30 +0200 Subject: [PATCH 17/18] [Orders] Add missing select payment validation group --- src/Resources/config/shop_routing.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Resources/config/shop_routing.yaml b/src/Resources/config/shop_routing.yaml index acd87ad7..dd0e8c3a 100644 --- a/src/Resources/config/shop_routing.yaml +++ b/src/Resources/config/shop_routing.yaml @@ -97,7 +97,7 @@ sylius_shop_order_show: form: type: Sylius\PayPalPlugin\Form\Type\SelectPaymentType options: - validation_groups: [] + validation_groups: [sylius_order_pay] redirect: route: sylius_shop_order_pay parameters: From 7e74663c8e256e085592c2f2d022a007718d17eb Mon Sep 17 00:00:00 2001 From: Rafikooo Date: Tue, 25 Apr 2023 10:43:03 +0200 Subject: [PATCH 18/18] [Maintenance] Bump sylius-rector version --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index a725b400..30e54454 100644 --- a/composer.json +++ b/composer.json @@ -33,7 +33,7 @@ "phpstan/phpstan-webmozart-assert": "^1.1", "phpunit/phpunit": "^8.5", "sylius-labs/coding-standard": "^4.0", - "sylius/sylius-rector": "0.11.x-dev", + "sylius/sylius-rector": "^1.0", "symfony/browser-kit": "^5.4 || ^6.0", "symfony/debug-bundle": "^5.4 || ^6.0", "symfony/dotenv": "^5.4 || ^6.0",