From 6f5956d19b888123d9d441f6d2d29cd3b8af3975 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Kali=C5=84ski?= Date: Mon, 22 Jul 2024 09:13:04 +0200 Subject: [PATCH 1/7] OP-375 - Added public folder files to .gitignore --- tests/Application/.gitignore | 1 + tests/Application/public/build/admin/entrypoints.json | 3 --- tests/Application/public/build/admin/manifest.json | 1 - tests/Application/public/build/shop/entrypoints.json | 3 --- tests/Application/public/build/shop/manifest.json | 1 - tests/Application/public/media/image/.gitignore | 0 6 files changed, 1 insertion(+), 8 deletions(-) delete mode 100644 tests/Application/public/build/admin/entrypoints.json delete mode 100644 tests/Application/public/build/admin/manifest.json delete mode 100644 tests/Application/public/build/shop/entrypoints.json delete mode 100644 tests/Application/public/build/shop/manifest.json delete mode 100644 tests/Application/public/media/image/.gitignore diff --git a/tests/Application/.gitignore b/tests/Application/.gitignore index 8ad1225..5a21be1 100644 --- a/tests/Application/.gitignore +++ b/tests/Application/.gitignore @@ -1,6 +1,7 @@ /public/assets /public/css /public/js +/public/build /public/media/* !/public/media/image/ /public/media/image/* diff --git a/tests/Application/public/build/admin/entrypoints.json b/tests/Application/public/build/admin/entrypoints.json deleted file mode 100644 index d386b6c..0000000 --- a/tests/Application/public/build/admin/entrypoints.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "entrypoints": {} -} diff --git a/tests/Application/public/build/admin/manifest.json b/tests/Application/public/build/admin/manifest.json deleted file mode 100644 index 0967ef4..0000000 --- a/tests/Application/public/build/admin/manifest.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/tests/Application/public/build/shop/entrypoints.json b/tests/Application/public/build/shop/entrypoints.json deleted file mode 100644 index d386b6c..0000000 --- a/tests/Application/public/build/shop/entrypoints.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "entrypoints": {} -} diff --git a/tests/Application/public/build/shop/manifest.json b/tests/Application/public/build/shop/manifest.json deleted file mode 100644 index 0967ef4..0000000 --- a/tests/Application/public/build/shop/manifest.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/tests/Application/public/media/image/.gitignore b/tests/Application/public/media/image/.gitignore deleted file mode 100644 index e69de29..0000000 From 224a0cfca2cbe0601adbb5636bdcd953ea469752 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Kali=C5=84ski?= Date: Mon, 22 Jul 2024 09:13:27 +0200 Subject: [PATCH 2/7] OP-375 - package.json updated (sass-loader) --- tests/Application/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Application/package.json b/tests/Application/package.json index 3de1fdb..81675d5 100644 --- a/tests/Application/package.json +++ b/tests/Application/package.json @@ -30,7 +30,7 @@ "rollup-plugin-node-resolve": "^3.3.0", "rollup-plugin-uglify": "^4.0.0", "node-sass": "^4.14", - "sass-loader": "^7.0.1", + "sass-loader": "^12.1.0", "upath": "^1.1.0", "yargs": "^6.4.0" }, From 26c31977623181a7f069b6232e5445ce820b00a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Kali=C5=84ski?= Date: Mon, 22 Jul 2024 10:49:03 +0200 Subject: [PATCH 3/7] OP-375 - Added Sylius 1.13 support --- composer.json | 4 +- .../sylius/1.11/packages/dev/swiftmailer.yaml | 2 - .../config/sylius/1.11/packages/security.yaml | 148 ------------------ .../sylius/1.11/packages/swiftmailer.yaml | 2 - .../sylius/1.11/packages/test/security.yaml | 3 - .../1.11/packages/test/swiftmailer.yaml | 6 - .../1.11/packages/test_cached/security.yaml | 3 - .../packages/test_cached/swiftmailer.yaml | 6 - .../config/sylius/{1.11 => 1.13}/bundles.php | 7 +- .../config/sylius/1.13/packages/mailer.yaml | 3 + .../config/sylius/1.13/packages/security.yaml | 124 +++++++++++++++ .../sylius/1.13/packages/test/mailer.yaml | 7 + 12 files changed, 140 insertions(+), 175 deletions(-) delete mode 100644 tests/Application/config/sylius/1.11/packages/dev/swiftmailer.yaml delete mode 100644 tests/Application/config/sylius/1.11/packages/security.yaml delete mode 100644 tests/Application/config/sylius/1.11/packages/swiftmailer.yaml delete mode 100644 tests/Application/config/sylius/1.11/packages/test/security.yaml delete mode 100644 tests/Application/config/sylius/1.11/packages/test/swiftmailer.yaml delete mode 100644 tests/Application/config/sylius/1.11/packages/test_cached/security.yaml delete mode 100644 tests/Application/config/sylius/1.11/packages/test_cached/swiftmailer.yaml rename tests/Application/config/sylius/{1.11 => 1.13}/bundles.php (80%) create mode 100644 tests/Application/config/sylius/1.13/packages/mailer.yaml create mode 100644 tests/Application/config/sylius/1.13/packages/security.yaml create mode 100644 tests/Application/config/sylius/1.13/packages/test/mailer.yaml diff --git a/composer.json b/composer.json index 53e7ab6..7e037e4 100644 --- a/composer.json +++ b/composer.json @@ -6,11 +6,11 @@ "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", + "behat/mink-selenium2-driver": "~1.6", "bitbag/coding-standard": "^1.0 || ^2.0", "dmore/behat-chrome-extension": "^1.3", "dmore/chrome-mink-driver": "^2.7", diff --git a/tests/Application/config/sylius/1.11/packages/dev/swiftmailer.yaml b/tests/Application/config/sylius/1.11/packages/dev/swiftmailer.yaml deleted file mode 100644 index 30eca8a..0000000 --- a/tests/Application/config/sylius/1.11/packages/dev/swiftmailer.yaml +++ /dev/null @@ -1,2 +0,0 @@ -swiftmailer: - disable_delivery: true diff --git a/tests/Application/config/sylius/1.11/packages/security.yaml b/tests/Application/config/sylius/1.11/packages/security.yaml deleted file mode 100644 index bdbc36d..0000000 --- a/tests/Application/config/sylius/1.11/packages/security.yaml +++ /dev/null @@ -1,148 +0,0 @@ -parameters: - sylius.security.admin_regex: "^/%sylius_admin.path_name%" - sylius.security.api_regex: "^/api" - sylius.security.shop_regex: "^/(?!%sylius_admin.path_name%|new-api|api/.*|api$|media/.*)[^/]++" - sylius.security.new_api_route: "/new-api" - sylius.security.new_api_regex: "^%sylius.security.new_api_route%" - sylius.security.new_api_admin_route: "%sylius.security.new_api_route%/admin" - sylius.security.new_api_admin_regex: "^%sylius.security.new_api_admin_route%" - sylius.security.new_api_shop_route: "%sylius.security.new_api_route%/shop" - sylius.security.new_api_shop_regex: "^%sylius.security.new_api_shop_route%" - -security: - always_authenticate_before_granting: true - providers: - sylius_admin_user_provider: - id: sylius.admin_user_provider.email_or_name_based - sylius_api_admin_user_provider: - id: sylius.admin_user_provider.email_or_name_based - sylius_shop_user_provider: - id: sylius.shop_user_provider.email_or_name_based - sylius_api_shop_user_provider: - id: sylius.shop_user_provider.email_or_name_based - sylius_api_chain_provider: - chain: - providers: [sylius_api_shop_user_provider, sylius_api_admin_user_provider] - - encoders: - Sylius\Component\User\Model\UserInterface: argon2i - firewalls: - admin: - switch_user: true - context: admin - pattern: "%sylius.security.admin_regex%" - provider: sylius_admin_user_provider - form_login: - provider: sylius_admin_user_provider - login_path: sylius_admin_login - check_path: sylius_admin_login_check - failure_path: sylius_admin_login - default_target_path: sylius_admin_dashboard - use_forward: false - use_referer: true - csrf_token_generator: security.csrf.token_manager - csrf_parameter: _csrf_admin_security_token - csrf_token_id: admin_authenticate - remember_me: - secret: "%env(APP_SECRET)%" - path: "/%sylius_admin.path_name%" - name: APP_ADMIN_REMEMBER_ME - lifetime: 31536000 - remember_me_parameter: _remember_me - logout: - path: sylius_admin_logout - target: sylius_admin_login - anonymous: true - - new_api_admin_user: - pattern: "%sylius.security.new_api_route%/admin-user-authentication-token" - provider: sylius_admin_user_provider - stateless: true - anonymous: true - json_login: - check_path: "%sylius.security.new_api_route%/admin-user-authentication-token" - username_path: email - password_path: password - success_handler: lexik_jwt_authentication.handler.authentication_success - failure_handler: lexik_jwt_authentication.handler.authentication_failure - guard: - authenticators: - - lexik_jwt_authentication.jwt_token_authenticator - - new_api_shop_user: - pattern: "%sylius.security.new_api_route%/shop-user-authentication-token" - provider: sylius_shop_user_provider - stateless: true - anonymous: true - json_login: - check_path: "%sylius.security.new_api_route%/shop-user-authentication-token" - username_path: email - password_path: password - success_handler: lexik_jwt_authentication.handler.authentication_success - failure_handler: lexik_jwt_authentication.handler.authentication_failure - guard: - authenticators: - - lexik_jwt_authentication.jwt_token_authenticator - - new_api: - pattern: "%sylius.security.new_api_regex%/*" - provider: sylius_api_chain_provider - stateless: true - anonymous: lazy - guard: - authenticators: - - lexik_jwt_authentication.jwt_token_authenticator - - shop: - switch_user: { role: ROLE_ALLOWED_TO_SWITCH } - context: shop - pattern: "%sylius.security.shop_regex%" - provider: sylius_shop_user_provider - form_login: - success_handler: sylius.authentication.success_handler - failure_handler: sylius.authentication.failure_handler - provider: sylius_shop_user_provider - login_path: sylius_shop_login - check_path: sylius_shop_login_check - failure_path: sylius_shop_login - default_target_path: sylius_shop_homepage - use_forward: false - use_referer: true - csrf_token_generator: security.csrf.token_manager - csrf_parameter: _csrf_shop_security_token - csrf_token_id: shop_authenticate - remember_me: - secret: "%env(APP_SECRET)%" - name: APP_SHOP_REMEMBER_ME - lifetime: 31536000 - remember_me_parameter: _remember_me - logout: - path: sylius_shop_logout - target: sylius_shop_login - invalidate_session: false - success_handler: sylius.handler.shop_user_logout - anonymous: true - - dev: - pattern: ^/(_(profiler|wdt)|css|images|js)/ - security: false - - access_control: - - { path: "%sylius.security.admin_regex%/_partial", role: IS_AUTHENTICATED_ANONYMOUSLY, ips: [127.0.0.1, ::1] } - - { path: "%sylius.security.admin_regex%/_partial", role: ROLE_NO_ACCESS } - - { path: "%sylius.security.shop_regex%/_partial", role: IS_AUTHENTICATED_ANONYMOUSLY, ips: [127.0.0.1, ::1] } - - { path: "%sylius.security.shop_regex%/_partial", role: ROLE_NO_ACCESS } - - - { path: "%sylius.security.admin_regex%/login", role: IS_AUTHENTICATED_ANONYMOUSLY } - - { path: "%sylius.security.api_regex%/login", role: IS_AUTHENTICATED_ANONYMOUSLY } - - { path: "%sylius.security.shop_regex%/login", role: IS_AUTHENTICATED_ANONYMOUSLY } - - - { path: "%sylius.security.shop_regex%/register", role: IS_AUTHENTICATED_ANONYMOUSLY } - - { path: "%sylius.security.shop_regex%/verify", role: IS_AUTHENTICATED_ANONYMOUSLY } - - - { path: "%sylius.security.admin_regex%", role: ROLE_ADMINISTRATION_ACCESS } - - { path: "%sylius.security.api_regex%/.*", role: ROLE_API_ACCESS } - - { path: "%sylius.security.shop_regex%/account", role: ROLE_USER } - - - { path: "%sylius.security.new_api_admin_regex%/.*", role: ROLE_API_ACCESS } - - { path: "%sylius.security.new_api_shop_regex%/.*", role: IS_AUTHENTICATED_ANONYMOUSLY } diff --git a/tests/Application/config/sylius/1.11/packages/swiftmailer.yaml b/tests/Application/config/sylius/1.11/packages/swiftmailer.yaml deleted file mode 100644 index 73bba27..0000000 --- a/tests/Application/config/sylius/1.11/packages/swiftmailer.yaml +++ /dev/null @@ -1,2 +0,0 @@ -swiftmailer: - url: '%env(MAILER_URL)%' diff --git a/tests/Application/config/sylius/1.11/packages/test/security.yaml b/tests/Application/config/sylius/1.11/packages/test/security.yaml deleted file mode 100644 index e6c3df6..0000000 --- a/tests/Application/config/sylius/1.11/packages/test/security.yaml +++ /dev/null @@ -1,3 +0,0 @@ -security: - encoders: - sha512: sha512 diff --git a/tests/Application/config/sylius/1.11/packages/test/swiftmailer.yaml b/tests/Application/config/sylius/1.11/packages/test/swiftmailer.yaml deleted file mode 100644 index aaac242..0000000 --- a/tests/Application/config/sylius/1.11/packages/test/swiftmailer.yaml +++ /dev/null @@ -1,6 +0,0 @@ -swiftmailer: - disable_delivery: true - logging: true - spool: - type: file - path: "%kernel.cache_dir%/spool" diff --git a/tests/Application/config/sylius/1.11/packages/test_cached/security.yaml b/tests/Application/config/sylius/1.11/packages/test_cached/security.yaml deleted file mode 100644 index e6c3df6..0000000 --- a/tests/Application/config/sylius/1.11/packages/test_cached/security.yaml +++ /dev/null @@ -1,3 +0,0 @@ -security: - encoders: - sha512: sha512 diff --git a/tests/Application/config/sylius/1.11/packages/test_cached/swiftmailer.yaml b/tests/Application/config/sylius/1.11/packages/test_cached/swiftmailer.yaml deleted file mode 100644 index aaac242..0000000 --- a/tests/Application/config/sylius/1.11/packages/test_cached/swiftmailer.yaml +++ /dev/null @@ -1,6 +0,0 @@ -swiftmailer: - disable_delivery: true - logging: true - spool: - type: file - path: "%kernel.cache_dir%/spool" diff --git a/tests/Application/config/sylius/1.11/bundles.php b/tests/Application/config/sylius/1.13/bundles.php similarity index 80% rename from tests/Application/config/sylius/1.11/bundles.php rename to tests/Application/config/sylius/1.13/bundles.php index 27e596b..0f4d2f7 100644 --- a/tests/Application/config/sylius/1.11/bundles.php +++ b/tests/Application/config/sylius/1.13/bundles.php @@ -9,9 +9,10 @@ declare(strict_types=1); return [ + League\FlysystemBundle\FlysystemBundle::class => ['all' => true], + Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true], + Sylius\Calendar\SyliusCalendarBundle::class => ['all' => true], BabDev\PagerfantaBundle\BabDevPagerfantaBundle::class => ['all' => true], - Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle::class => ['all' => true], SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true], - Sylius\Calendar\SyliusCalendarBundle::class => ['all' => true], - Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true], + Sylius\Abstraction\StateMachine\SyliusStateMachineAbstractionBundle::class => ['all' => true], ]; diff --git a/tests/Application/config/sylius/1.13/packages/mailer.yaml b/tests/Application/config/sylius/1.13/packages/mailer.yaml new file mode 100644 index 0000000..0a0697c --- /dev/null +++ b/tests/Application/config/sylius/1.13/packages/mailer.yaml @@ -0,0 +1,3 @@ +framework: + mailer: + dsn: '%env(MAILER_DSN)%' diff --git a/tests/Application/config/sylius/1.13/packages/security.yaml b/tests/Application/config/sylius/1.13/packages/security.yaml new file mode 100644 index 0000000..4ed342f --- /dev/null +++ b/tests/Application/config/sylius/1.13/packages/security.yaml @@ -0,0 +1,124 @@ +security: + enable_authenticator_manager: true + providers: + sylius_admin_user_provider: + id: sylius.admin_user_provider.email_or_name_based + sylius_api_admin_user_provider: + id: sylius.admin_user_provider.email_or_name_based + sylius_shop_user_provider: + id: sylius.shop_user_provider.email_or_name_based + sylius_api_shop_user_provider: + id: sylius.shop_user_provider.email_or_name_based + + password_hashers: + Sylius\Component\User\Model\UserInterface: argon2i + firewalls: + admin: + switch_user: true + context: admin + pattern: "%sylius.security.admin_regex%" + provider: sylius_admin_user_provider + form_login: + provider: sylius_admin_user_provider + login_path: sylius_admin_login + check_path: sylius_admin_login_check + failure_path: sylius_admin_login + default_target_path: sylius_admin_dashboard + use_forward: false + use_referer: true + enable_csrf: true + csrf_parameter: _csrf_admin_security_token + csrf_token_id: admin_authenticate + remember_me: + secret: "%env(APP_SECRET)%" + path: "/%sylius_admin.path_name%" + name: APP_ADMIN_REMEMBER_ME + lifetime: 31536000 + remember_me_parameter: _remember_me + logout: + path: sylius_admin_logout + target: sylius_admin_login + + new_api_admin_user: + pattern: "%sylius.security.new_api_admin_regex%/.*" + provider: sylius_api_admin_user_provider + stateless: true + entry_point: jwt + json_login: + check_path: "%sylius.security.new_api_admin_route%/authentication-token" + username_path: email + password_path: password + success_handler: lexik_jwt_authentication.handler.authentication_success + failure_handler: lexik_jwt_authentication.handler.authentication_failure + jwt: true + + new_api_shop_user: + pattern: "%sylius.security.new_api_shop_regex%/.*" + provider: sylius_api_shop_user_provider + stateless: true + entry_point: jwt + json_login: + check_path: "%sylius.security.new_api_shop_route%/authentication-token" + username_path: email + password_path: password + success_handler: lexik_jwt_authentication.handler.authentication_success + failure_handler: lexik_jwt_authentication.handler.authentication_failure + jwt: true + + shop: + switch_user: { role: ROLE_ALLOWED_TO_SWITCH } + context: shop + pattern: "%sylius.security.shop_regex%" + provider: sylius_shop_user_provider + form_login: + success_handler: sylius.authentication.success_handler + failure_handler: sylius.authentication.failure_handler + provider: sylius_shop_user_provider + login_path: sylius_shop_login + check_path: sylius_shop_login_check + failure_path: sylius_shop_login + default_target_path: sylius_shop_homepage + use_forward: false + use_referer: true + enable_csrf: true + csrf_parameter: _csrf_shop_security_token + csrf_token_id: shop_authenticate + remember_me: + secret: "%env(APP_SECRET)%" + name: APP_SHOP_REMEMBER_ME + lifetime: 31536000 + remember_me_parameter: _remember_me + logout: + path: sylius_shop_logout + target: sylius_shop_homepage + invalidate_session: false + + dev: + pattern: ^/(_(profiler|wdt)|css|images|js)/ + security: false + + image_resolver: + pattern: ^/media/cache/resolve + security: false + + access_control: + - { path: "%sylius.security.admin_regex%/_partial", role: PUBLIC_ACCESS, ips: [127.0.0.1, ::1] } + - { path: "%sylius.security.admin_regex%/_partial", role: ROLE_NO_ACCESS } + - { path: "%sylius.security.shop_regex%/_partial", role: PUBLIC_ACCESS, ips: [127.0.0.1, ::1] } + - { path: "%sylius.security.shop_regex%/_partial", role: ROLE_NO_ACCESS } + + - { path: "%sylius.security.admin_regex%/login", role: PUBLIC_ACCESS } + - { path: "%sylius.security.shop_regex%/login", role: PUBLIC_ACCESS } + + - { path: "%sylius.security.shop_regex%/register", role: PUBLIC_ACCESS } + - { path: "%sylius.security.shop_regex%/verify", role: PUBLIC_ACCESS } + + - { path: "%sylius.security.admin_regex%", role: ROLE_ADMINISTRATION_ACCESS } + - { path: "%sylius.security.shop_regex%/account", role: ROLE_USER } + + - { path: "%sylius.security.new_api_admin_route%/reset-password-requests", role: PUBLIC_ACCESS } + - { path: "%sylius.security.new_api_admin_regex%/.*", role: ROLE_API_ACCESS } + - { path: "%sylius.security.new_api_admin_route%/authentication-token", role: PUBLIC_ACCESS } + - { path: "%sylius.security.new_api_user_account_regex%/.*", role: ROLE_USER } + - { path: "%sylius.security.new_api_shop_route%/authentication-token", role: PUBLIC_ACCESS } + - { path: "%sylius.security.new_api_shop_regex%/.*", role: PUBLIC_ACCESS } diff --git a/tests/Application/config/sylius/1.13/packages/test/mailer.yaml b/tests/Application/config/sylius/1.13/packages/test/mailer.yaml new file mode 100644 index 0000000..56cc28f --- /dev/null +++ b/tests/Application/config/sylius/1.13/packages/test/mailer.yaml @@ -0,0 +1,7 @@ +framework: + mailer: + dsn: 'null://null' + cache: + pools: + test.mailer_pool: + adapter: cache.adapter.filesystem From ce32ef8a7392578c20a332d54ac000e4cff062ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Kali=C5=84ski?= Date: Mon, 22 Jul 2024 11:18:05 +0200 Subject: [PATCH 4/7] OP-375 - composer.json updated -> Behat / CodingStandard --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 7e037e4..cdd2770 100644 --- a/composer.json +++ b/composer.json @@ -10,8 +10,8 @@ }, "require-dev": { "behat/behat": "^3.7", - "behat/mink-selenium2-driver": "~1.6", - "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", From 75a2ff07a2c0c815f1572c692a5ab24424018790 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Kali=C5=84ski?= Date: Mon, 22 Jul 2024 11:18:19 +0200 Subject: [PATCH 5/7] OP-375 - PHPStan - config updated --- phpstan.neon | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/phpstan.neon b/phpstan.neon index 724e474..7a2a673 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,6 +1,11 @@ parameters: + level: 8 + + paths: + - src + reportUnmatchedIgnoredErrors: false - checkMissingIterableValueType: false + treatPhpDocTypesAsCertain: false excludePaths: # Makes PHPStan crash @@ -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./' From d82d6bbaabdc8d423869830ef2cdaf5f34c3a60c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Kali=C5=84ski?= Date: Mon, 22 Jul 2024 11:45:04 +0200 Subject: [PATCH 6/7] OP-375 - ECS (CS 3.0) fixed --- ecs.php | 15 ++++++--------- src/Api/Serializer/CatalogNormalizer.php | 17 +++++++++-------- src/BitBagSyliusCatalogPlugin.php | 9 +++++---- src/Checker/Rule/Doctrine/AbstractRule.php | 11 ++++++----- src/Checker/Rule/Doctrine/AttributeRule.php | 19 ++++++++++--------- .../Rule/Doctrine/AttributeRuleInterface.php | 9 +++++---- src/Checker/Rule/Doctrine/PriceRule.php | 19 ++++++++++--------- src/Checker/Rule/Doctrine/ProductCodeLike.php | 11 ++++++----- src/Checker/Rule/Doctrine/ProductNameRule.php | 11 ++++++----- src/Checker/Rule/Doctrine/RuleInterface.php | 11 ++++++----- src/Checker/Rule/Doctrine/TaxonRule.php | 12 ++++++------ .../Rule/Elasticsearch/AttributeRule.php | 13 +++++++------ src/Checker/Rule/Elasticsearch/PriceRule.php | 11 ++++++----- .../Rule/Elasticsearch/ProductNameRule.php | 11 ++++++----- .../Rule/Elasticsearch/RuleInterface.php | 9 +++++---- src/Checker/Rule/Elasticsearch/TaxonRule.php | 11 ++++++----- src/Checker/Sort/Doctrine/CheapestSort.php | 9 +++++---- .../Sort/Doctrine/MostExpensiveSort.php | 9 +++++---- src/Checker/Sort/Doctrine/NewestSort.php | 9 +++++---- src/Checker/Sort/Doctrine/OldestSort.php | 9 +++++---- src/Checker/Sort/Doctrine/SortInterface.php | 9 +++++---- .../Sort/Elasticsearch/CheapestSort.php | 11 ++++++----- .../Sort/Elasticsearch/MostExpensiveSort.php | 11 ++++++----- src/Checker/Sort/Elasticsearch/NewestSort.php | 9 +++++---- src/Checker/Sort/Elasticsearch/OldestSort.php | 9 +++++---- .../Sort/Elasticsearch/SoldUnitsSort.php | 9 +++++---- .../Sort/Elasticsearch/SortInterface.php | 9 +++++---- src/Choices/Catalog.php | 11 ++++++----- src/Choices/CatalogInterface.php | 3 ++- src/Choices/CatalogMapper.php | 9 +++++---- src/Choices/CatalogMapperInterface.php | 10 ++++++---- src/Controller/Shop/ShowCatalogAction.php | 11 ++++++----- .../BitBagSyliusCatalogExtension.php | 18 ++++++++++-------- .../Compiler/CatalogRuleCheckersPass.php | 15 ++++++++------- .../Compiler/CatalogSortChecker.php | 15 ++++++++------- src/DependencyInjection/Configuration.php | 9 +++++---- src/Entity/AbstractCatalogRule.php | 9 +++++---- src/Entity/Catalog.php | 9 +++++---- src/Entity/CatalogInterface.php | 9 +++++---- src/Entity/CatalogRule.php | 9 +++++---- src/Entity/CatalogRuleInterface.php | 9 +++++---- src/Entity/CatalogSubjectInterface.php | 10 +++++----- src/Entity/CatalogTranslation.php | 9 +++++---- src/Entity/CatalogTranslationInterface.php | 9 +++++---- .../ConfigurableCatalogElementInterface.php | 9 +++++---- src/Entity/ProductAssociationRule.php | 9 +++++---- .../ProductAssociationRuleInterface.php | 9 +++++---- .../AttributeStorageTypeNotFound.php | 9 +++++---- src/Fixture/CatalogFixture.php | 10 +++++----- src/Fixture/Factory/CatalogFixtureFactory.php | 13 +++++++------ ...AbstractConfigurableCatalogElementType.php | 13 +++++++------ .../Type/AttributeAutocompleteChoiceType.php | 11 ++++++----- src/Form/Type/AttributeConfigurationType.php | 9 +++++---- src/Form/Type/CatalogRuleChoiceType.php | 9 +++++---- src/Form/Type/CatalogRuleCollectionType.php | 9 +++++---- src/Form/Type/CatalogRuleType.php | 9 +++++---- src/Form/Type/CatalogType.php | 13 +++++++------ src/Form/Type/ChannelBasedRulePricing.php | 11 ++++++----- src/Form/Type/ChannelPriceType.php | 10 ++-------- .../AbstractConfigurationCollectionType.php | 15 ++++++++------- .../FirstVariantPriceConfigurationType.php | 9 +++++---- src/Form/Type/PriceConfigurationType.php | 9 +++++---- .../Type/ProductAssociationRuleChoiceType.php | 9 +++++---- .../ProductAssociationRuleCollectionType.php | 9 +++++---- src/Form/Type/ProductAssociationRuleType.php | 9 +++++---- .../Type/ProductCodeLikeConfigurationType.php | 9 +++++---- .../Type/ProductNameConfigurationType.php | 9 +++++---- src/Form/Type/TaxonConfigurationType.php | 9 +++++---- .../Translation/CatalogTranslationType.php | 9 +++++---- src/Menu/AdminMenuListener.php | 9 +++++---- src/QueryBuilder/ProductQueryBuilder.php | 13 ++++++------- .../ProductQueryBuilderInterface.php | 11 +++++------ src/Repository/AttributeRepository.php | 9 +++++---- .../AttributeRepositoryInterface.php | 9 +++++---- src/Repository/CatalogRepository.php | 13 +++++++------ src/Repository/CatalogRepositoryInterface.php | 9 +++++---- src/Resolver/CatalogResourceResolver.php | 11 ++++++----- .../CatalogResourceResolverInterface.php | 9 +++++---- src/Resolver/CatalogsForProductResolver.php | 17 ++++++++--------- .../CatalogsForProductResolverInterface.php | 10 +++++----- .../CompleteCatalogsForProductResolver.php | 19 +++++++++---------- .../CatalogsForProductResolver.php | 19 +++++++++---------- .../ProductsInsideCatalogResolver.php | 15 ++++++++------- .../ProductsInsideCatalogResolver.php | 19 ++++++++++--------- ...ProductsInsideCatalogResolverInterface.php | 9 +++++---- src/Twig/Extension/RenderCatalogExtension.php | 11 ++++++----- .../RenderProductCatalogsExtension.php | 17 +++++++++-------- tests/Application/config/bootstrap.php | 7 +++++++ tests/Application/config/bundles.php | 9 +++++---- .../config/sylius/1.12/bundles.php | 9 +++++---- .../config/sylius/1.13/bundles.php | 9 +++++---- tests/Application/public/index.php | 7 +++++++ .../ChecksCodeImmutabilityInterface.php | 9 +++++---- .../Behaviour/ChecksCodeImmutabilityTrait.php | 9 +++++---- .../Behaviour/ContainsEmptyListInterface.php | 9 +++++---- .../Behaviour/ContainsEmptyListTrait.php | 9 +++++---- .../Behaviour/ContainsErrorInterface.php | 9 +++++---- tests/Behat/Behaviour/ContainsErrorTrait.php | 9 +++++---- tests/Behat/Context/Setup/CatalogContext.php | 11 ++++++----- .../Behat/Context/Ui/Admin/CatalogContext.php | 15 ++++++++------- tests/Behat/Page/Admin/Catalog/CreatePage.php | 9 +++++---- .../Admin/Catalog/CreatePageInterface.php | 9 +++++---- tests/Behat/Page/Admin/Catalog/IndexPage.php | 9 +++++---- .../Page/Admin/Catalog/IndexPageInterface.php | 9 +++++---- tests/Behat/Page/Admin/Catalog/UpdatePage.php | 9 +++++---- .../Admin/Catalog/UpdatePageInterface.php | 9 +++++---- tests/Behat/Service/RandomStringGenerator.php | 9 +++++---- .../RandomStringGeneratorInterface.php | 9 +++++---- 108 files changed, 622 insertions(+), 525 deletions(-) diff --git a/ecs.php b/ecs.php index b088160..abcfbcf 100644 --- a/ecs.php +++ b/ecs.php @@ -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']); }; diff --git a/src/Api/Serializer/CatalogNormalizer.php b/src/Api/Serializer/CatalogNormalizer.php index 61e60bc..c11f87d 100644 --- a/src/Api/Serializer/CatalogNormalizer.php +++ b/src/Api/Serializer/CatalogNormalizer.php @@ -1,10 +1,11 @@ productResolver = $productResolver; } @@ -35,8 +36,8 @@ public function __construct( public function normalize( $object, ?string $format = null, - array $context = [] - ):array { + array $context = [], + ): array { Assert::isInstanceOf($object, CatalogInterface::class); Assert::keyNotExists($context, self::ALREADY_CALLED); @@ -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; diff --git a/src/BitBagSyliusCatalogPlugin.php b/src/BitBagSyliusCatalogPlugin.php index afec956..9e6e678 100644 --- a/src/BitBagSyliusCatalogPlugin.php +++ b/src/BitBagSyliusCatalogPlugin.php @@ -1,10 +1,11 @@ getAttributeStorageFieldName($attribute->getType()); @@ -73,9 +74,9 @@ private function buildRule( self::SELECT_ATTRIBUTE_PATTERN, $this->getValueHashKey( $attribute->getConfiguration(), - $value - ) - ) + $value, + ), + ), ) ; } diff --git a/src/Checker/Rule/Doctrine/AttributeRuleInterface.php b/src/Checker/Rule/Doctrine/AttributeRuleInterface.php index 938474b..559eddd 100644 --- a/src/Checker/Rule/Doctrine/AttributeRuleInterface.php +++ b/src/Checker/Rule/Doctrine/AttributeRuleInterface.php @@ -1,10 +1,11 @@ generateParameterName(); $channelCodeParameter = $this->generateParameterName(); @@ -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 @@ -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++); @@ -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++); @@ -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: diff --git a/src/Checker/Rule/Doctrine/ProductCodeLike.php b/src/Checker/Rule/Doctrine/ProductCodeLike.php index c127c00..bd9adde 100644 --- a/src/Checker/Rule/Doctrine/ProductCodeLike.php +++ b/src/Checker/Rule/Doctrine/ProductCodeLike.php @@ -1,10 +1,11 @@ generateParameterName(); diff --git a/src/Checker/Rule/Doctrine/ProductNameRule.php b/src/Checker/Rule/Doctrine/ProductNameRule.php index 7b6f902..908a54e 100644 --- a/src/Checker/Rule/Doctrine/ProductNameRule.php +++ b/src/Checker/Rule/Doctrine/ProductNameRule.php @@ -1,10 +1,11 @@ i; $locale = $this->localeContext->getLocaleCode(); diff --git a/src/Checker/Rule/Doctrine/RuleInterface.php b/src/Checker/Rule/Doctrine/RuleInterface.php index 0dcc8f8..7591aa9 100644 --- a/src/Checker/Rule/Doctrine/RuleInterface.php +++ b/src/Checker/Rule/Doctrine/RuleInterface.php @@ -1,10 +1,11 @@ generateParameterName(); diff --git a/src/Checker/Rule/Elasticsearch/AttributeRule.php b/src/Checker/Rule/Elasticsearch/AttributeRule.php index c48dd55..e5f394b 100644 --- a/src/Checker/Rule/Elasticsearch/AttributeRule.php +++ b/src/Checker/Rule/Elasticsearch/AttributeRule.php @@ -1,10 +1,11 @@ stringFormatter = $stringFormatter; $this->localeContext = $localeContext; @@ -51,7 +52,7 @@ public function createSubquery(array $configuration): AbstractQuery $paramName = \sprintf( '%s_%s.keyword', $this->attributeNameResolver->resolvePropertyName($attribute->getCode()), - $this->localeContext->getLocaleCode() + $this->localeContext->getLocaleCode(), ); if (in_array($attribute->getStorageType(), [DateAttributeType::TYPE, DatetimeAttributeType::TYPE])) { diff --git a/src/Checker/Rule/Elasticsearch/PriceRule.php b/src/Checker/Rule/Elasticsearch/PriceRule.php index 8ac66b2..1df1190 100644 --- a/src/Checker/Rule/Elasticsearch/PriceRule.php +++ b/src/Checker/Rule/Elasticsearch/PriceRule.php @@ -1,10 +1,11 @@ channelContext = $channelContext; $this->propertyNameResolver = $propertyNameResolver; diff --git a/src/Checker/Rule/Elasticsearch/ProductNameRule.php b/src/Checker/Rule/Elasticsearch/ProductNameRule.php index 9f9d52a..eae1eec 100644 --- a/src/Checker/Rule/Elasticsearch/ProductNameRule.php +++ b/src/Checker/Rule/Elasticsearch/ProductNameRule.php @@ -1,17 +1,18 @@ getCode(); }, - $configuration['taxons']->toArray() + $configuration['taxons']->toArray(), ); /* @phpstan-ignore-next-line Elastica\Query\Terms Class extended by Elastica\Query\AbstractQuery*/ diff --git a/src/Checker/Sort/Doctrine/CheapestSort.php b/src/Checker/Sort/Doctrine/CheapestSort.php index bcbdecc..1d755a4 100644 --- a/src/Checker/Sort/Doctrine/CheapestSort.php +++ b/src/Checker/Sort/Doctrine/CheapestSort.php @@ -1,10 +1,11 @@ channelPricingNameResolver = $channelPricingNameResolver; $this->channelContext = $channelContext; diff --git a/src/Checker/Sort/Elasticsearch/MostExpensiveSort.php b/src/Checker/Sort/Elasticsearch/MostExpensiveSort.php index 47c1d83..6f63853 100644 --- a/src/Checker/Sort/Elasticsearch/MostExpensiveSort.php +++ b/src/Checker/Sort/Elasticsearch/MostExpensiveSort.php @@ -1,10 +1,11 @@ channelPricingNameResolver = $channelPricingNameResolver; $this->channelContext = $channelContext; diff --git a/src/Checker/Sort/Elasticsearch/NewestSort.php b/src/Checker/Sort/Elasticsearch/NewestSort.php index be18b5f..9bcb40c 100644 --- a/src/Checker/Sort/Elasticsearch/NewestSort.php +++ b/src/Checker/Sort/Elasticsearch/NewestSort.php @@ -1,10 +1,11 @@ fullTemplatePath = $fullTemplatePath; $this->catalogMapper = $catalogMapper; diff --git a/src/Choices/CatalogInterface.php b/src/Choices/CatalogInterface.php index 5f00df6..f122c50 100644 --- a/src/Choices/CatalogInterface.php +++ b/src/Choices/CatalogInterface.php @@ -1,11 +1,12 @@ twig = $twig; $this->catalogRepository = $catalogRepository; diff --git a/src/DependencyInjection/BitBagSyliusCatalogExtension.php b/src/DependencyInjection/BitBagSyliusCatalogExtension.php index f10794b..8157eb7 100644 --- a/src/DependencyInjection/BitBagSyliusCatalogExtension.php +++ b/src/DependencyInjection/BitBagSyliusCatalogExtension.php @@ -1,10 +1,11 @@ setDefinition( 'bitbag_sylius_catalog_plugin.form.type.catalog_rule.choice', $container->getDefinition('bitbag_sylius_catalog_plugin.form.type.catalog_rule.choice') - ->setArgument(0, sprintf('%%bitbag_sylius_catalog_plugin.catalog_rules.%s%%', $config['driver'])) + ->setArgument(0, sprintf('%%bitbag_sylius_catalog_plugin.catalog_rules.%s%%', $config['driver'])), ); $container->setDefinition( 'bitbag_sylius_catalog_plugin.form.type.channel_pricing', $container->getDefinition('bitbag_sylius_catalog_plugin.form.type.channel_pricing') - ->setArgument(0, sprintf('%%bitbag_sylius_catalog_plugin.catalog_rules.%s%%', $config['driver'])) + ->setArgument(0, sprintf('%%bitbag_sylius_catalog_plugin.catalog_rules.%s%%', $config['driver'])), ); $container->setDefinition( 'bitbag_sylius_catalog_plugin.form.type.product_association_rule.choice', $container->getDefinition('bitbag_sylius_catalog_plugin.form.type.product_association_rule.choice') - ->setArgument(0, sprintf('%%bitbag_sylius_catalog_plugin.product_association_rules.%s%%', $config['driver'])) + ->setArgument(0, sprintf('%%bitbag_sylius_catalog_plugin.product_association_rules.%s%%', $config['driver'])), ); $container->setDefinition( 'bitbag_sylius_catalog_plugin.form.type.catalog', $container->getDefinition('bitbag_sylius_catalog_plugin.form.type.catalog') - ->setArgument(1, sprintf('%%bitbag_sylius_catalog_plugin.catalog_sorts.%s%%', $config['driver'])) + ->setArgument(1, sprintf('%%bitbag_sylius_catalog_plugin.catalog_sorts.%s%%', $config['driver'])), ); $container->setParameter('bitbag_sylius_catalog_plugin.parameters.templates_dir', $config['templates_dir']); @@ -71,6 +72,7 @@ public function getConfiguration(array $config, ContainerBuilder $container): Co { /** @var string $result */ $result = $container->getParameter('kernel.project_dir'); + return new Configuration($result); } diff --git a/src/DependencyInjection/Compiler/CatalogRuleCheckersPass.php b/src/DependencyInjection/Compiler/CatalogRuleCheckersPass.php index fc369f8..6680f68 100644 --- a/src/DependencyInjection/Compiler/CatalogRuleCheckersPass.php +++ b/src/DependencyInjection/Compiler/CatalogRuleCheckersPass.php @@ -1,10 +1,11 @@ getDefinition($id)->getClass(); - if (is_null($objectOrClass)) { + if (null === $objectOrClass) { return false; } /** @phpstan-ignore-next-line */ @@ -46,7 +47,7 @@ private function serviceImplementsInterface( private function addDriverRulesToRegistries( string $driver, ContainerBuilder $container, - string $ruleInterface + string $ruleInterface, ): void { $driverRuleRegistry = sprintf('bitbag_sylius_catalog_plugin.registry_catalog_rule_checker.%s', $driver); $driverFormRegistry = sprintf('bitbag_sylius_catalog_plugin.form_registry.catalog_rule_checker.%s', $driver); diff --git a/src/DependencyInjection/Compiler/CatalogSortChecker.php b/src/DependencyInjection/Compiler/CatalogSortChecker.php index 1d11257..8bcc556 100644 --- a/src/DependencyInjection/Compiler/CatalogSortChecker.php +++ b/src/DependencyInjection/Compiler/CatalogSortChecker.php @@ -1,10 +1,11 @@ getDefinition($id)->getClass(); - if (is_null($objectOrClass)) { + if (null === $objectOrClass) { return false; } @@ -47,7 +48,7 @@ private function serviceImplementsInterface( private function addDriverSortsToRegistries( string $driver, ContainerBuilder $container, - string $sortInterface + string $sortInterface, ): void { $driverSortRegistry = sprintf('bitbag_sylius_catalog_plugin.registry_catalog_sort_checker.%s', $driver); diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index 6fb726e..15b285c 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -1,10 +1,11 @@ */ public function getCatalogs(): Collection; diff --git a/src/Entity/CatalogTranslation.php b/src/Entity/CatalogTranslation.php index 761a659..a89f242 100644 --- a/src/Entity/CatalogTranslation.php +++ b/src/Entity/CatalogTranslation.php @@ -1,10 +1,11 @@ catalogFactory = $catalogFactory; $this->catalogRepository = $catalogRepository; @@ -92,7 +93,7 @@ private function createCatalog(string $code, array $catalogData): void private function createRule( array $rule, string $ruleTarget, - CatalogInterface $catalog + CatalogInterface $catalog, ): void { /** @var CatalogRuleInterface $catalogRule */ $catalogRule = $this->catalogRuleFactory->createNew(); diff --git a/src/Form/Type/AbstractConfigurableCatalogElementType.php b/src/Form/Type/AbstractConfigurableCatalogElementType.php index 2e760a3..4c3ce6d 100644 --- a/src/Form/Type/AbstractConfigurableCatalogElementType.php +++ b/src/Form/Type/AbstractConfigurableCatalogElementType.php @@ -1,10 +1,11 @@ false, ]) ->add('isNegation', CheckboxType::class, [ - 'label' => 'bitbag_sylius_catalog_plugin.ui.is_negation' + 'label' => 'bitbag_sylius_catalog_plugin.ui.is_negation', ]) ; } diff --git a/src/Form/Type/AttributeAutocompleteChoiceType.php b/src/Form/Type/AttributeAutocompleteChoiceType.php index 57d1514..a4db6b8 100644 --- a/src/Form/Type/AttributeAutocompleteChoiceType.php +++ b/src/Form/Type/AttributeAutocompleteChoiceType.php @@ -1,10 +1,11 @@ vars['remote_criteria_type'] = 'contains'; $view->vars['remote_criteria_name'] = 'code'; diff --git a/src/Form/Type/AttributeConfigurationType.php b/src/Form/Type/AttributeConfigurationType.php index 27535a4..6627a58 100644 --- a/src/Form/Type/AttributeConfigurationType.php +++ b/src/Form/Type/AttributeConfigurationType.php @@ -1,10 +1,11 @@ 'bitbag_sylius_catalog_plugin.ui.number_of_products', 'choices' => array_combine( range(1, 12, 1), - range(1, 12, 1) + range(1, 12, 1), ), ]) ->add('translations', ResourceTranslationsType::class, [ diff --git a/src/Form/Type/ChannelBasedRulePricing.php b/src/Form/Type/ChannelBasedRulePricing.php index 8cfedaf..58aac7e 100644 --- a/src/Form/Type/ChannelBasedRulePricing.php +++ b/src/Form/Type/ChannelBasedRulePricing.php @@ -1,10 +1,11 @@ function (ChannelInterface $channel) { return [ 'label' => $channel->getCode(), - 'currency' => !is_null($channel->getBaseCurrency()) ? $channel->getBaseCurrency()->getCode() : null, + 'currency' => null !== $channel->getBaseCurrency() ? $channel->getBaseCurrency()->getCode() : null, ]; }, ]); diff --git a/src/Form/Type/ChannelPriceType.php b/src/Form/Type/ChannelPriceType.php index f1e0143..48283bf 100644 --- a/src/Form/Type/ChannelPriceType.php +++ b/src/Form/Type/ChannelPriceType.php @@ -1,13 +1,5 @@ $type] - ) + ['configuration_type' => $type], + ), ); $prototypes[$type] = $formBuilder->getForm(); @@ -52,7 +53,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void public function buildView( FormView $view, FormInterface $form, - array $options + array $options, ): void { $view->vars['prototypes'] = []; diff --git a/src/Form/Type/FirstVariantPriceConfigurationType.php b/src/Form/Type/FirstVariantPriceConfigurationType.php index d07daac..e23e216 100644 --- a/src/Form/Type/FirstVariantPriceConfigurationType.php +++ b/src/Form/Type/FirstVariantPriceConfigurationType.php @@ -1,10 +1,11 @@ serviceRegistry = $serviceRegistry; $this->hasChannelQueryBuilder = $hasChannelQueryBuilder; @@ -37,9 +38,7 @@ public function __construct( } /** - * @param string $connectingRules * @param Collection $rules - * @return BoolQuery */ public function findMatchingProductsQuery(string $connectingRules, Collection $rules): BoolQuery { diff --git a/src/QueryBuilder/ProductQueryBuilderInterface.php b/src/QueryBuilder/ProductQueryBuilderInterface.php index 333c2c3..802e60f 100644 --- a/src/QueryBuilder/ProductQueryBuilderInterface.php +++ b/src/QueryBuilder/ProductQueryBuilderInterface.php @@ -1,10 +1,11 @@ $rules - * @return BoolQuery */ public function findMatchingProductsQuery(string $connectingRules, Collection $rules): BoolQuery; } diff --git a/src/Repository/AttributeRepository.php b/src/Repository/AttributeRepository.php index 1ad472d..07b1647 100644 --- a/src/Repository/AttributeRepository.php +++ b/src/Repository/AttributeRepository.php @@ -1,10 +1,11 @@ expr()->orX( $qb->expr()->lte('o.startDate', ':on'), - $qb->expr()->isNull('o.startDate') + $qb->expr()->isNull('o.startDate'), ); $endsQuery = $qb->expr()->orX( $qb->expr()->gte('o.endDate', ':on'), - $qb->expr()->isNull('o.endDate') + $qb->expr()->isNull('o.endDate'), ); return $qb diff --git a/src/Repository/CatalogRepositoryInterface.php b/src/Repository/CatalogRepositoryInterface.php index c7133f1..906b1e6 100644 --- a/src/Repository/CatalogRepositoryInterface.php +++ b/src/Repository/CatalogRepositoryInterface.php @@ -1,10 +1,11 @@ logger->warning(sprintf( 'Catalog with "%s" code was not found in the database.', - $code + $code, )); return null; diff --git a/src/Resolver/CatalogResourceResolverInterface.php b/src/Resolver/CatalogResourceResolverInterface.php index 36e378f..c2ac34f 100644 --- a/src/Resolver/CatalogResourceResolverInterface.php +++ b/src/Resolver/CatalogResourceResolverInterface.php @@ -1,10 +1,11 @@ catalogRepository = $catalogRepository; $this->serviceRegistry = $serviceRegistry; @@ -68,8 +67,8 @@ public function resolveProductCatalogs(ProductInterface $product, \DateTimeImmut foreach ($rules as $rule) { $type = $rule->getType(); - if (is_null($type) - ||is_null($connectingRules)) { + if (null === $type || + null === $connectingRules) { continue; } diff --git a/src/Resolver/CatalogsForProductResolverInterface.php b/src/Resolver/CatalogsForProductResolverInterface.php index 7b0c9f1..727284c 100644 --- a/src/Resolver/CatalogsForProductResolverInterface.php +++ b/src/Resolver/CatalogsForProductResolverInterface.php @@ -1,16 +1,16 @@ wrappedResolver = $wrappedResolver; $this->catalogResolver = $catalogResolver; } - - public function resolveProductCatalogs(ProductInterface $product, \DateTimeImmutable $dataTime): array { return @@ -41,12 +40,12 @@ function (CatalogInterface $catalog) { 'products' => $this->catalogResolver->findMatchingProducts($catalog), ]; }, - $this->wrappedResolver->resolveProductCatalogs($product, $dataTime) + $this->wrappedResolver->resolveProductCatalogs($product, $dataTime), ), function (array $catalogData) { return 0 < count($catalogData['products']); - } - ) + }, + ), ) ; } diff --git a/src/Resolver/Elasticsearch/CatalogsForProductResolver.php b/src/Resolver/Elasticsearch/CatalogsForProductResolver.php index a3718c6..d62fed6 100644 --- a/src/Resolver/Elasticsearch/CatalogsForProductResolver.php +++ b/src/Resolver/Elasticsearch/CatalogsForProductResolver.php @@ -1,10 +1,11 @@ catalogRepository = $catalogRepository; $this->productQueryBuilder = $productQueryBuilder; @@ -50,17 +50,16 @@ public function resolveProductCatalogs(ProductInterface $product, \DateTimeImmut foreach ($activeCatalogs as $activeCatalog) { if ((bool) $activeCatalog->getProductAssociationRules()->count()) { $boolQuery = new BoolQuery(); - if (is_null($activeCatalog->getProductAssociationConnectingRules())) { + if (null === $activeCatalog->getProductAssociationConnectingRules()) { continue; } $boolQuery->addMust( $this->productQueryBuilder->findMatchingProductsQuery( $activeCatalog->getProductAssociationConnectingRules(), - $activeCatalog->getProductAssociationRules() - ) + $activeCatalog->getProductAssociationRules(), + ), ); - $idTerm = new Term(); $idTerm->setTerm('_id', $product->getId()); $boolQuery->addMust($idTerm); diff --git a/src/Resolver/Elasticsearch/ProductsInsideCatalogResolver.php b/src/Resolver/Elasticsearch/ProductsInsideCatalogResolver.php index 36f2d08..1181ec4 100644 --- a/src/Resolver/Elasticsearch/ProductsInsideCatalogResolver.php +++ b/src/Resolver/Elasticsearch/ProductsInsideCatalogResolver.php @@ -1,10 +1,11 @@ productQueryBuilder = $productQueryBuilder; $this->productFinder = $paginatedFinder; @@ -40,8 +41,8 @@ public function findMatchingProducts(CatalogInterface $catalog): array { $query = new BoolQuery(); - if (is_null($catalog->getConnectingRules()) - || is_null($catalog->getSortingType())) { + if (null === $catalog->getConnectingRules() || + null === $catalog->getSortingType()) { return []; } diff --git a/src/Resolver/ProductsInsideCatalogResolver.php b/src/Resolver/ProductsInsideCatalogResolver.php index 4c885ea..173464b 100644 --- a/src/Resolver/ProductsInsideCatalogResolver.php +++ b/src/Resolver/ProductsInsideCatalogResolver.php @@ -1,10 +1,11 @@ ruleServiceRegistry = $ruleServiceRegistry; $this->productRepository = $productRepository; @@ -38,9 +39,9 @@ public function __construct( public function findMatchingProducts(CatalogInterface $catalog): array { - if (is_null($catalog->getConnectingRules()) - || is_null($catalog->getSortingType()) - || is_null($catalog->getDisplayProducts())) { + if (null === $catalog->getConnectingRules() || + null === $catalog->getSortingType() || + null === $catalog->getDisplayProducts()) { return []; } @@ -64,7 +65,7 @@ public function findMatchingProducts(CatalogInterface $catalog): array foreach ($rules as $rule) { $type = $rule->getType(); - if (is_null($type)) { + if (null === $type) { continue; } diff --git a/src/Resolver/ProductsInsideCatalogResolverInterface.php b/src/Resolver/ProductsInsideCatalogResolverInterface.php index 1ab739b..bb0d9b8 100644 --- a/src/Resolver/ProductsInsideCatalogResolverInterface.php +++ b/src/Resolver/ProductsInsideCatalogResolverInterface.php @@ -1,10 +1,11 @@ productResolver = $productResolver; $this->engine = $engine; diff --git a/src/Twig/Extension/RenderProductCatalogsExtension.php b/src/Twig/Extension/RenderProductCatalogsExtension.php index 1e9a082..a3f2302 100644 --- a/src/Twig/Extension/RenderProductCatalogsExtension.php +++ b/src/Twig/Extension/RenderProductCatalogsExtension.php @@ -1,10 +1,11 @@ engine = $engine; $this->productCatalogResolver = $productCatalogResolver; @@ -40,16 +41,16 @@ public function getFunctions(): array public function renderProductCatalogs( ProductInterface $product, ?string $date = null, - ?string $template = null + ?string $template = null, ): string { return $this->engine->render( $template ?? '@BitBagSyliusCatalogPlugin/Product/showCatalogs.html.twig', [ 'catalogs' => $this->productCatalogResolver->resolveProductCatalogs( $product, - new \DateTimeImmutable($date ?? 'now') + new \DateTimeImmutable($date ?? 'now'), ), - ] + ], ); } } diff --git a/tests/Application/config/bootstrap.php b/tests/Application/config/bootstrap.php index 2291ab4..450a654 100644 --- a/tests/Application/config/bootstrap.php +++ b/tests/Application/config/bootstrap.php @@ -1,5 +1,12 @@ sharedStorage = $sharedStorage; $this->catalogFactory = $catalogFactory; diff --git a/tests/Behat/Context/Ui/Admin/CatalogContext.php b/tests/Behat/Context/Ui/Admin/CatalogContext.php index 6c19ab8..b92a621 100755 --- a/tests/Behat/Context/Ui/Admin/CatalogContext.php +++ b/tests/Behat/Context/Ui/Admin/CatalogContext.php @@ -1,10 +1,11 @@ sharedStorage = $sharedStorage; $this->currentPageResolver = $currentPageResolver; @@ -101,7 +102,7 @@ public function iShouldBeNotifiedThatNewCatalogHasBeenCreated(): void { $this->notificationChecker->checkNotification( 'Catalog has been successfully created.', - NotificationType::success() + NotificationType::success(), ); } @@ -112,7 +113,7 @@ public function iShouldBeNotifiedThatTheCatalogHasBeenDeleted(): void { $this->notificationChecker->checkNotification( 'Catalog has been successfully deleted.', - NotificationType::success() + NotificationType::success(), ); } diff --git a/tests/Behat/Page/Admin/Catalog/CreatePage.php b/tests/Behat/Page/Admin/Catalog/CreatePage.php index abed762..7f2c7c1 100755 --- a/tests/Behat/Page/Admin/Catalog/CreatePage.php +++ b/tests/Behat/Page/Admin/Catalog/CreatePage.php @@ -1,10 +1,11 @@ Date: Mon, 22 Jul 2024 11:48:07 +0200 Subject: [PATCH 7/7] OP-375 - Workflows build.yml has been updated --- .github/workflows/build.yml | 16 ++++++++-------- composer.json | 3 +++ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 54fbb0c..60ac160 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,15 +21,15 @@ 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 @@ -37,7 +37,7 @@ jobs: steps: - - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup PHP @@ -50,7 +50,7 @@ jobs: - name: Setup Node - uses: actions/setup-node@v1 + uses: actions/setup-node@v4 with: node-version: "${{ matrix.node }}" @@ -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') }} diff --git a/composer.json b/composer.json index cdd2770..a044984 100644 --- a/composer.json +++ b/composer.json @@ -48,6 +48,9 @@ "symfony/thanks": true } }, + "conflict": { + "doctrine/persistence": "<3.0" + }, "autoload": { "psr-4": { "BitBag\\SyliusCatalogPlugin\\": "src/",