Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.x] feat(upgrade): bump codebase to match sylius v[1.12|1.13|1.14] #64

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .github/workflows/analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Analysis
'on':
push:
branches:
- master
- main
paths-ignore:
- README.md
pull_request:
Expand All @@ -16,11 +16,10 @@ jobs:
fail-fast: false
matrix:
php:
- 8.0
- 8.2
- 8.3
symfony:
- '5.4.*'
- '6.2.*'
- '6.4.*'
env:
APP_ENV: test
steps:
Expand Down
15 changes: 4 additions & 11 deletions .github/workflows/sylius.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,16 @@ jobs:
fail-fast: false
matrix:
php:
- 8.0
- 8.2
- 8.3
sylius:
- 1.10.0
- 1.12.0
- 1.13.0
- 1.14.0
symfony:
- 5.4
- 6.2
- 6.4
node:
- 14.x
exclude:
-
sylius: 1.10.0
symfony: 6.2
-
php: '8.0'
symfony: 6.2
env:
APP_ENV: test
package-name: synolia/sylius-gdpr-plugin
Expand Down
22 changes: 10 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
SHELL=/bin/bash
COMPOSER_ROOT=composer
TEST_DIRECTORY=tests/Application
CONSOLE=cd tests/Application && php bin/console -e test
COMPOSER=cd tests/Application && composer
YARN=cd tests/Application && yarn
INSTALL_DIRECTORY=install/Application
CONSOLE=cd ${TEST_DIRECTORY} && php bin/console -e test
COMPOSER=cd ${TEST_DIRECTORY} && composer
YARN=cd ${TEST_DIRECTORY} && yarn

SYLIUS_VERSION=1.12.0
SYMFONY_VERSION=6.1
PHP_VERSION=8.1
SYLIUS_VERSION=1.14.0
SYMFONY_VERSION=6.4
PHP_VERSION=8.2
PLUGIN_NAME=synolia/sylius-gdpr-plugin

###
Expand All @@ -19,10 +20,10 @@ install: sylius ## Install Plugin on Sylius [SYLIUS_VERSION=1.12.0] [SYMFONY_VER
.PHONY: install

reset: ## Remove dependencies
ifneq ("$(wildcard tests/Application/bin/console)","")
ifneq ("$(wildcard ${TEST_DIRECTORY}/bin/console)","")
${CONSOLE} doctrine:database:drop --force --if-exists || true
endif
rm -rf tests/Application
rm -rf ${TEST_DIRECTORY}
.PHONY: reset

phpunit: phpunit-configure phpunit-run ## Run PHPUnit
Expand All @@ -43,9 +44,6 @@ sylius-standard:
update-dependencies:
${COMPOSER} config extra.symfony.require "~${SYMFONY_VERSION}"
${COMPOSER} require symfony/asset:~${SYMFONY_VERSION} --no-scripts --no-update
ifeq ($(SYLIUS_VERSION), 1.9.0)
${COMPOSER} require laminas/laminas-stdlib:3.4.0 --no-scripts --no-update
endif
${COMPOSER} update --no-progress -n

install-plugin:
Expand All @@ -54,7 +52,7 @@ install-plugin:
${COMPOSER} config minimum-stability "dev"
${COMPOSER} config prefer-stable true
${COMPOSER} req ${PLUGIN_NAME}:* --prefer-source --no-scripts
cp -r install/Application tests
cp -r ${INSTALL_DIRECTORY} tests
cp -r tests/data/* ${TEST_DIRECTORY}/

install-sylius:
Expand Down
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@

| | Version |
|:-------|:--------|
| PHP | ^8.0 |
| Sylius | ^1.10 |
| PHP | ^8.2 |
| Sylius | ^1.12 |

## Installation

Expand All @@ -44,18 +44,19 @@
composer require synolia/sylius-gdpr-plugin --no-scripts
```

2. Import required config in your `config/packages/_sylius.yaml` file:
2. Create required config in `config/packages/gdpr.yaml` file:

```yaml
imports:
- { resource: "@SynoliaSyliusGDPRPlugin/Resources/config/app/config.yaml" }
- { resource: "@SynoliaSyliusGDPRPlugin/config/gdpr.yaml" }
```

3. Import routing in your `config/routes.yaml` file:
3. Create routing in `config/routes/gdpr.yaml` file:

```yaml
synolia_gdpr:
resource: "@SynoliaSyliusGDPRPlugin/Resources/config/routes.yaml"
resource: "@SynoliaSyliusGDPRPlugin/config/routes/attributes.yaml"
prefix: '/%sylius_admin.path_name%'
```

4. Process translations
Expand Down Expand Up @@ -108,7 +109,7 @@ Sylius\Component\Core\Model\Customer:
### Note:
> your expression language must starts with `@=` to be evaluated properly

> variable `object` is the current entity your are dealing with (eg. in that case `Sylius\Component\Core\Model\Customer`)
> variable `object` is the current entity you are dealing with (e.g. in that case `Sylius\Component\Core\Model\Customer`)

## Add form in advanced actions page

Expand All @@ -123,6 +124,8 @@ There's two steps to add your custom form into the page:
- 'Synolia\SyliusGDPRPlugin\Form\Type\Actions\AnonymizeCustomerNotLoggedSinceType'
tags: ['controller.service_arguments']
```

> or use php attributes `#[AsController]` on your controller and `#[Autowire(AnonymizeCustomerNotLoggedSinceType::class)]` in your constructor for `$formsType` parameter

- Then create your form processor by implementing Synolia\SyliusGDPRPlugin\Processor\AnonymizerProcessor\AdvancedActionsFormDataProcessorInterface

Expand Down
File renamed without changes.
46 changes: 23 additions & 23 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,33 @@
],
"license": "EUPL-1.2",
"require": {
"php": "^8.0",
"php": "^8.2",
"php-http/message-factory": "^1.1",
"phpdocumentor/reflection-docblock": "^5.3",
"sylius/sylius": "^1.10",
"symfony/property-info": "^5.4|^6.0"
"sylius/sylius": "^1.12",
"symfony/property-info": "^6.4"
},
"require-dev": {
"j13k/yaml-lint": "1.1.4",
"php-parallel-lint/php-parallel-lint": "1.3.2",
"phpmd/phpmd": "2.13.0",
"phpro/grumphp": "1.15.0",
"phpstan/extension-installer": "1.2.0",
"phpstan/phpstan": "1.9.7",
"phpstan/phpstan-doctrine": "1.3.29",
"phpstan/phpstan-strict-rules": "1.4.4",
"phpstan/phpstan-webmozart-assert": "1.2.2",
"phpunit/phpunit": "9.5.27",
"povils/phpmnd": "3.0.1",
"rector/rector": "^0.15.2",
"seld/jsonlint": "1.9.0",
"sylius-labs/coding-standard": "4.3.0",
"symfony/browser-kit": "6.0.11",
"symfony/debug-bundle": "6.0.11",
"symfony/dotenv": "6.0.5",
"symfony/intl": "6.0.15",
"symfony/web-profiler-bundle": "6.0.17",
"thecodingmachine/phpstan-strict-rules": "1.0.0"
"j13k/yaml-lint": "^1.1",
"php-parallel-lint/php-parallel-lint": "^1.4",
"phpmd/phpmd": "^2.15.0",
"phpro/grumphp": "^2.9",
"phpstan/extension-installer": "^1.3",
"phpstan/phpstan": "^2.0",
"phpstan/phpstan-doctrine": "^2.0",
"phpstan/phpstan-strict-rules": "^2.0",
"phpstan/phpstan-webmozart-assert": "^2.0",
"phpunit/phpunit": "^9.5",
"povils/phpmnd": "^3.0",
"rector/rector": "^2.0",
"seld/jsonlint": "^1.11",
"squizlabs/php_codesniffer": "^3.11",
"sylius-labs/coding-standard": "^4.3",
"symfony/browser-kit": "^6.4",
"symfony/debug-bundle": "^6.4",
"symfony/dotenv": "^6.4",
"symfony/intl": "^6.4",
"symfony/web-profiler-bundle": "^6.4"
},
"config": {
"sort-packages": true,
Expand Down
2 changes: 2 additions & 0 deletions config/gdpr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
imports:
- { resource: "@SynoliaSyliusGDPRPlugin/config/packages/ui.yaml" }
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions config/routes/attributes.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
controllers:
resource:
path: ../../src/Controller/
namespace: Synolia\SyliusGDPRPlugin\Controller
type: attribute
8 changes: 8 additions & 0 deletions config/services.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
services:
_defaults:
autowire: true
autoconfigure: true

Synolia\SyliusGDPRPlugin\:
resource: '../src/*'
exclude: '../src/{SynoliaSyliusGDPRPlugin.php}'
33 changes: 9 additions & 24 deletions grumphp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,31 @@ grumphp:
ascii:
failed: ~
succeeded: ~
ignore_unstaged_changes: true
tasks:
composer:
file: "composer.json"
no_check_all: true
git_blacklist:
keywords:
- "var_dump"
- "dump("
- "print_r"
- "die("
triggered_by: [php, twig]
jsonlint:
detect_key_conflicts: true
phplint:
exclude: ['vendor', 'tests/Application/*']
triggered_by: ['php']
phpmd:
ruleset: ["ruleset/.php_md.xml"]
exclude: ["src/Migrations/*"]
phpstan:
configuration: "ruleset/phpstan.neon"
level: ~
configuration: "ruleset/phpstan.neon"
use_grumphp_paths: false
xmllint: ~
yamllint: ~
ecs:
config: 'ruleset/ecs.php'
no-progress-bar: true
phpmnd:
directory: src
testsuites:
git_pre_commit:
tasks:
- composer
- git_blacklist
- jsonlint
- phplint
- phpmd
- phpstan
- xmllint
- yamllint
- ecs
- phpmnd
phpcs:
standard: "ruleset"
warning_severity: 0
whitelist_patterns:
- 'src'
exclude:
- 'PSR12.Files.FileHeader'
2 changes: 1 addition & 1 deletion install/Application/config/packages/gdpr.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
imports:
- { resource: "@SynoliaSyliusGDPRPlugin/Resources/config/app/config.yaml" }
- { resource: "@SynoliaSyliusGDPRPlugin/config/gdpr.yaml" }
3 changes: 2 additions & 1 deletion install/Application/config/routes/gdpr.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
synolia_gdpr:
resource: "@SynoliaSyliusGDPRPlugin/Resources/config/routes.yaml"
resource: "@SynoliaSyliusGDPRPlugin/config/routes/attributes.yaml"
prefix: '/%sylius_admin.path_name%'
11 changes: 5 additions & 6 deletions ruleset/phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
parameters:
level: max
level: 8
reportUnmatchedIgnoredErrors: false
checkMissingIterableValueType: false
checkGenericClassInNonGenericObjectType: false
paths:
- ../src
bootstrapFiles:
- '../vendor/autoload.php'
excludePaths:
- '../vendor/'
- '../src/Migrations/'
- '../source/src/Kernel.php'
- '../dev'
- '../bin'
- '../tests'
- '../src/DependencyInjection'
- '../src/SynoliaSyliusGDPRPlugin.php'
ignoreErrors:
- identifier: missingType.iterableValue
- identifier: missingType.generics
- '#Parameter \#1 \$className of static method Doctrine\\Common\\Util\\ClassUtils::newReflectionClass\(\) expects class-string, string given.#'
- '#Variable method call on object.#'
- '#Variable method call on mixed.#'
Expand Down
36 changes: 24 additions & 12 deletions ruleset/rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,31 @@

declare(strict_types=1);

use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;
use Rector\Symfony\Set\SymfonySetList;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->paths([
dirname(__DIR__) . '/src',
dirname(__DIR__) . '/tests/PHPUnit',
return RectorConfig::configure()
->withPaths([
\dirname(__DIR__, 1) . '/src',
\dirname(__DIR__, 1) . '/tests/PHPUnit',
])
->withPHPStanConfigs([__DIR__ . '/phpstan.neon'])
->withPhpSets(php82: true)
->withAttributesSets(symfony: true, doctrine: true)
->withPreparedSets(
deadCode: true,
codeQuality: true,
doctrineCodeQuality: true,
symfonyConfigs: true,
)
->withTypeCoverageLevel(0)
->withSets([
SymfonySetList::SYMFONY_60,
SymfonySetList::SYMFONY_61,
SymfonySetList::SYMFONY_62,
SymfonySetList::SYMFONY_63,
SymfonySetList::SYMFONY_64,
SetList::CODE_QUALITY,
SetList::DEAD_CODE,
]);

$rectorConfig->sets([
LevelSetList::UP_TO_PHP_74,
LevelSetList::UP_TO_PHP_80
]);
};
19 changes: 19 additions & 0 deletions ruleset/ruleset.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../vendor/squizlabs/php_codesniffer/phpcs.xsd">
<arg name="colors"/>
<arg name="extensions" value="php"/>
<rule ref="PSR12"/>

<rule ref="Generic.PHP.ForbiddenFunctions">
<properties>
<property name="forbiddenFunctions" type="array">
<element key="dd" value="null"/>
<element key="die" value="null"/>
<element key="dump" value="null"/>
<element key="print_r" value="null"/>
<element key="var_dump" value="null"/>
</property>
</properties>
</rule>
</ruleset>
Loading
Loading