Skip to content

Commit

Permalink
Merge pull request #43 from tomkalon/OP-375
Browse files Browse the repository at this point in the history
Op 375 - Upgrade Sylius version to 1.13
  • Loading branch information
senghe authored Jul 25, 2024
2 parents cbe8b64 + fe83a68 commit 6fb021e
Show file tree
Hide file tree
Showing 129 changed files with 794 additions and 729 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,23 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ["8.0"]
php: ["8.0", "8.1", "8.2"]
symfony: ["^5.4", "^6.0"]
sylius: ["~1.11.0", "~1.12.0"]
sylius: ["~1.12.0", "~1.13.0"]
node: ["14.x"]
mysql: ["5.7", "8.0"]

exclude:
- sylius: ~1.11.0
symfony: ^6.0
- sylius: "~1.13.0"
php: "8.0"

env:
APP_ENV: test
DATABASE_URL: "mysql://root:root@127.0.0.1/sylius?serverVersion=${{ matrix.mysql }}"

steps:
-
uses: actions/checkout@v2
uses: actions/checkout@v3

-
name: Setup PHP
Expand All @@ -50,7 +50,7 @@ jobs:

-
name: Setup Node
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: "${{ matrix.node }}"

Expand Down Expand Up @@ -181,7 +181,7 @@ jobs:
path: etc/build/
if-no-files-found: ignore

-
-
name: Failed build Slack notification
uses: rtCamp/action-slack-notify@v2
if: ${{ failure() && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') }}
Expand Down
9 changes: 6 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
"license": "MIT",
"require": {
"php": "^8.0",
"sylius/sylius": "~1.11.0 || ~1.12.0"
"sylius/sylius": "~1.12.0 || ~1.13.0"
},
"require-dev": {
"behat/behat": "^3.7",
"behat/mink-selenium2-driver": "^1.4",
"bitbag/coding-standard": "^1.0 || ^2.0",
"behat/mink-selenium2-driver": "~1.6.0",
"bitbag/coding-standard": "^3.0",
"dmore/behat-chrome-extension": "^1.3",
"dmore/chrome-mink-driver": "^2.7",
"friends-of-behat/mink": "^1.8",
Expand Down Expand Up @@ -48,6 +48,9 @@
"symfony/thanks": true
}
},
"conflict": {
"doctrine/persistence": "<3.0"
},
"autoload": {
"psr-4": {
"BitBag\\SyliusCatalogPlugin\\": "src/",
Expand Down
15 changes: 6 additions & 9 deletions ecs.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@

declare(strict_types=1);

use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\EasyCodingStandard\ValueObject\Option;
use Symplify\EasyCodingStandard\Config\ECSConfig;

return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->import('vendor/bitbag/coding-standard/ecs.php');
return static function (ECSConfig $config): void {

$parameters = $containerConfigurator->parameters();
$parameters->set(Option::PATHS, [
__DIR__ . '/src',
__DIR__ . '/tests',
]);
putenv('ALLOW_BITBAG_OS_HEADER=1');

$config->import('vendor/bitbag/coding-standard/ecs.php');
$config->paths(['src', 'tests']);
};
9 changes: 8 additions & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
parameters:
level: 8

paths:
- src

reportUnmatchedIgnoredErrors: false
checkMissingIterableValueType: false
treatPhpDocTypesAsCertain: false

excludePaths:
# Makes PHPStan crash
Expand All @@ -11,6 +16,8 @@ parameters:
- 'tests/Application/src/**.php'

ignoreErrors:
- identifier: missingType.iterableValue
- identifier: missingType.generics
- '/Parameter #1 \$configuration of method Symfony\\Component\\DependencyInjection\\Extension\\Extension::processConfiguration\(\) expects Symfony\\Component\\Config\\Definition\\ConfigurationInterface, Symfony\\Component\\Config\\Definition\\ConfigurationInterface\|null given\./'
-
message: '/Property [a-zA-Z\\]+::\$[a-zA-Z]+ has unknown class FOS\\ElasticaBundle\\[a-zA-Z\\]+ as its type./'
Expand Down
17 changes: 9 additions & 8 deletions src/Api/Serializer/CatalogNormalizer.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php

/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/

declare(strict_types=1);

Expand All @@ -27,16 +28,16 @@ final class CatalogNormalizer implements ContextAwareNormalizerInterface, Normal
private $productResolver;

public function __construct(
ProductsInsideCatalogResolverInterface $productResolver
ProductsInsideCatalogResolverInterface $productResolver,
) {
$this->productResolver = $productResolver;
}

public function normalize(
$object,
?string $format = null,
array $context = []
):array {
array $context = [],
): array {
Assert::isInstanceOf($object, CatalogInterface::class);
Assert::keyNotExists($context, self::ALREADY_CALLED);

Expand All @@ -56,7 +57,7 @@ public function normalize(
public function supportsNormalization(
$data,
?string $format = null,
array $context = []
array $context = [],
): bool {
if (isset($context[self::ALREADY_CALLED])) {
return false;
Expand Down
9 changes: 5 additions & 4 deletions src/BitBagSyliusCatalogPlugin.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php

/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/

declare(strict_types=1);

Expand Down
11 changes: 6 additions & 5 deletions src/Checker/Rule/Doctrine/AbstractRule.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php

/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/

declare(strict_types=1);

Expand All @@ -24,7 +25,7 @@ abstract class AbstractRule implements RuleInterface
protected function addRule(
string $connectingRules,
QueryBuilder $queryBuilder,
$rule
$rule,
): void {
switch ($connectingRules) {
case RuleInterface::AND:
Expand Down
19 changes: 10 additions & 9 deletions src/Checker/Rule/Doctrine/AttributeRule.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php

/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/

declare(strict_types=1);

Expand All @@ -31,7 +32,7 @@ public function __construct(LocaleContextInterface $localeContext)
public function modifyQueryBuilder(
array $configuration,
QueryBuilder $queryBuilder,
string $connectingRules
string $connectingRules,
): void {
/** @var AttributeInterface $attribute */
$attribute = $configuration['attribute'];
Expand All @@ -48,7 +49,7 @@ public function modifyQueryBuilder(
private function buildRule(
QueryBuilder $queryBuilder,
AttributeInterface $attribute,
string $value
string $value,
): Andx {
$valueFieldName = self::PRODUCT_ATTRIBUTES_ALIAS . '.' . $this->getAttributeStorageFieldName($attribute->getType());

Expand All @@ -73,9 +74,9 @@ private function buildRule(
self::SELECT_ATTRIBUTE_PATTERN,
$this->getValueHashKey(
$attribute->getConfiguration(),
$value
)
)
$value,
),
),
)
;
}
Expand Down
9 changes: 5 additions & 4 deletions src/Checker/Rule/Doctrine/AttributeRuleInterface.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php

/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/

declare(strict_types=1);

Expand Down
19 changes: 10 additions & 9 deletions src/Checker/Rule/Doctrine/PriceRule.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php

/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/

declare(strict_types=1);

Expand All @@ -31,7 +32,7 @@ public function __construct(ChannelContextInterface $channelContext)
public function modifyQueryBuilder(
array $configuration,
QueryBuilder $queryBuilder,
string $connectingRules
string $connectingRules,
): void {
$priceParameter = $this->generateParameterName();
$channelCodeParameter = $this->generateParameterName();
Expand All @@ -42,7 +43,7 @@ public function modifyQueryBuilder(
$this->addRule(
$connectingRules,
$queryBuilder,
$this->createFromFromOperator($configuration['operator'], $queryBuilder, $channelCodeParameter, $priceParameter)
$this->createFromFromOperator($configuration['operator'], $queryBuilder, $channelCodeParameter, $priceParameter),
);

$queryBuilder
Expand All @@ -60,7 +61,7 @@ private function anyVariantRule(
QueryBuilder $queryBuilder,
string $channelCodeParameter,
string $subqueryOperator,
string $priceParameter
string $priceParameter,
): Func {
$productVariantAlias = sprintf('pv%d', $this->i++);
$channelPricingAlias = sprintf('cp%d', $this->i++);
Expand All @@ -81,7 +82,7 @@ private function allVariantsRule(
QueryBuilder $queryBuilder,
string $channelCodeParameter,
string $subqueryOperator,
string $priceParameter
string $priceParameter,
): Func {
$productVariantAlias = sprintf('pv%d', $this->i++);
$channelPricingAlias = sprintf('cp%d', $this->i++);
Expand All @@ -102,7 +103,7 @@ private function createFromFromOperator(
string $operator,
QueryBuilder $queryBuilder,
string $channelCodeParameter,
string $priceParameter
string $priceParameter,
): Func {
switch ($operator) {
case PriceConfigurationType::OPERATOR_ALL_GT:
Expand Down
11 changes: 6 additions & 5 deletions src/Checker/Rule/Doctrine/ProductCodeLike.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php

/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/

declare(strict_types=1);

Expand All @@ -29,7 +30,7 @@ final class ProductCodeLike extends AbstractRule implements RuleInterface
public function modifyQueryBuilder(
array $configuration,
QueryBuilder $queryBuilder,
string $connectingRules
string $connectingRules,
): void {
$parameterName = $this->generateParameterName();

Expand Down
11 changes: 6 additions & 5 deletions src/Checker/Rule/Doctrine/ProductNameRule.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php

/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/

declare(strict_types=1);

Expand All @@ -27,7 +28,7 @@ public function __construct(LocaleContextInterface $localeContext)
public function modifyQueryBuilder(
array $configuration,
QueryBuilder $queryBuilder,
string $connectingRules
string $connectingRules,
): void {
$parameterName = 'configurationName' . $this->i;
$locale = $this->localeContext->getLocaleCode();
Expand Down
Loading

0 comments on commit 6fb021e

Please sign in to comment.