Skip to content

Commit

Permalink
minor #274 [Maintenance] Remove Sylius 1.11 support and clean conflic…
Browse files Browse the repository at this point in the history
…ts (Rafikooo)

This PR was merged into the 1.5 branch.

Discussion
----------

| Q               | A
| --------------- | -----
| Branch?         | 1.5
| Bug fix?        | no
| New feature?    | no


Commits
-------

25cd0c9 [Maintenance] Remove Sylius 1.11 support and clean conflicts
3b215c7 [Maintenance] Add new SYLIUS_MESSENGER envs
b2b96aa [CI] Remove Sylius 1.11 from jobs
926a68d [Maintenance] Fix psalm errors
d6d16d0 [Migration] Extend AbstractMigration from SyliusCoreBundle
0e7420a [Psalm] Ignore Symfony\Component\Security\Core\Security class deprecation alert
ac81e7f [PHPStan] Bump to stable ^1.6 package version
23c951e [ECS] Update config file
ce69570 [Psalm] Suppress UnnecesaryVarAnnotation and UndefinedDocblockClass errors
f974b5a [CI][PHPStan] Use level from the configuration file
  • Loading branch information
TheMilek authored Apr 19, 2023
2 parents 3e5001c + f974b5a commit 563eeea
Show file tree
Hide file tree
Showing 14 changed files with 80 additions and 40 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:[email protected]/sylius?serverVersion=${{ matrix.mysql }}"
Expand Down
23 changes: 9 additions & 14 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -26,26 +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"
},
"conflict": {
"doctrine/doctrine-bundle": "2.3.0",
"doctrine/dbal": "^3.0.0",
"sylius/invoicing-plugin": "<0.16.0"
"symfony/webpack-encore-bundle": "^1.15",
"vimeo/psalm": "4.27.0"
},
"autoload": {
"psr-4": {
Expand Down Expand Up @@ -73,7 +68,7 @@
"scripts": {
"analyse": [
"@composer validate --strict",
"vendor/bin/phpstan.phar analyse -c phpstan.neon -l max src/",
"vendor/bin/phpstan.phar analyse",
"vendor/bin/psalm"
],
"fix": [
Expand Down
7 changes: 4 additions & 3 deletions ecs.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
]);
Expand Down
2 changes: 2 additions & 0 deletions phpstan.neon → phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ includes:
- vendor/phpstan/phpstan-webmozart-assert/extension.neon

parameters:
level: 3

reportUnmatchedIgnoredErrors: false
checkMissingIterableValueType: false
checkGenericClassInNonGenericObjectType: false
Expand Down
12 changes: 12 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,24 @@
</projectFiles>

<issueHandlers>
<UndefinedDocblockClass>
<errorLevel type="suppress">
<referencedClass name="UnitEnum" />
</errorLevel>
</UndefinedDocblockClass>

<DeprecatedMethod>
<errorLevel type="info">
<referencedMethod name="Payum\Core\Model\GatewayConfigInterface::getFactoryName" />
</errorLevel>
</DeprecatedMethod>

<DeprecatedClass>
<errorLevel type="info">
<referencedClass name="Symfony\Component\Security\Core\Security" />
</errorLevel>
</DeprecatedClass>

<MissingParamType>
<errorLevel type="info">
<file name="src/Payum/Request/CompleteOrder.php"/>
Expand Down
8 changes: 7 additions & 1 deletion src/Controller/CancelPayPalCheckoutPaymentAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@ public function __construct(

public function __invoke(Request $request): Response
{
$content = (array) json_decode((string) $request->getContent(false), true);
/**
* @var string $content
* @psalm-suppress UnnecessaryVarAnnotation
*/
$content = $request->getContent();

$content = (array) json_decode($content, true);

$payment = $this->paymentProvider->getByPayPalOrderId((string) $content['payPalOrderId']);

Expand Down
8 changes: 7 additions & 1 deletion src/Controller/CancelPayPalOrderAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,13 @@ public function __construct(

public function __invoke(Request $request): Response
{
$content = (array) json_decode((string) $request->getContent(false), true);
/**
* @var string $content
* @psalm-suppress UnnecessaryVarAnnotation
*/
$content = $request->getContent();

$content = (array) json_decode($content, true);

$payment = $this->paymentProvider->getByPayPalOrderId((string) $content['payPalOrderId']);

Expand Down
8 changes: 7 additions & 1 deletion src/Controller/CancelPayPalPaymentAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,13 @@ public function __construct(

public function __invoke(Request $request): Response
{
$content = (array) json_decode((string) $request->getContent(false), true);
/**
* @var string $content
* @psalm-suppress UnnecessaryVarAnnotation
*/
$content = $request->getContent();

$content = (array) json_decode($content, true);

$payment = $this->paymentProvider->getByPayPalOrderId((string) $content['payPalOrderId']);

Expand Down
8 changes: 7 additions & 1 deletion src/Controller/PayPalPaymentOnErrorAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@ public function __construct(FlashBagInterface|RequestStack $flashBagOrRequestSta

public function __invoke(Request $request): Response
{
$this->logger->error((string) $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')
;
Expand Down
8 changes: 7 additions & 1 deletion src/Controller/Webhook/RefundOrderAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,13 @@ public function __invoke(Request $request): Response

private function getPayPalPaymentUrl(Request $request): string
{
$content = (array) json_decode((string) $request->getContent(false), 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');
Expand Down
15 changes: 3 additions & 12 deletions src/Migrations/Version20200907102535.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
}
2 changes: 1 addition & 1 deletion src/UrlUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions tests/Application/.env
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@ DATABASE_URL=mysql://[email protected]/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
Expand Down
7 changes: 7 additions & 0 deletions tests/Application/.env.test
Original file line number Diff line number Diff line change
Expand Up @@ -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 ###

0 comments on commit 563eeea

Please sign in to comment.