From 124da5b0cfb1cc5ea6b1dfcffc82eca202dc63d1 Mon Sep 17 00:00:00 2001 From: Kevin Kaniaburka Date: Thu, 22 Sep 2022 08:56:28 +0200 Subject: [PATCH 1/9] [GitHub Actions] Add Sylius 1.12 to the matrix --- tests/Application/package.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/Application/package.json b/tests/Application/package.json index 1916d10f..7dc72d6c 100644 --- a/tests/Application/package.json +++ b/tests/Application/package.json @@ -40,7 +40,12 @@ "gulp-uglifycss": "^1.1.0", "merge-stream": "^2.0.0", "rollup": "^2.79.0", + "rollup-plugin-babel": "^3.0.4", + "rollup-plugin-commonjs": "^9.1.3", + "rollup-plugin-inject": "^2.0.0", + "rollup-plugin-node-resolve": "^3.3.0", "rollup-plugin-terser": "^7.0.2", + "rollup-plugin-uglify": "^4.0.0", "sass": "^1.54.8", "sass-loader": "^13.0.0", "upath": "^2.0.1", From 69d029fbe5c59be4f61729eed6e4c4958b65a856 Mon Sep 17 00:00:00 2001 From: Kevin Kaniaburka Date: Mon, 17 Oct 2022 11:25:57 +0200 Subject: [PATCH 2/9] [Maintenance] Add support for Symfony 6 --- .github/workflows/build.yml | 10 +++++++--- composer.json | 17 +++++++++-------- src/Resources/config/admin_routing.yml | 4 ++-- src/Resources/config/shop_routing.yml | 2 +- .../Application/config/routes/sylius_shop.yaml | 2 +- 5 files changed, 20 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 10a526fb..472441a7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,7 +20,7 @@ jobs: fail-fast: false matrix: php: ["8.0", "8.1"] - symfony: ["^5.4"] + symfony: ["^5.4", "^6.0"] sylius: ["~1.11.2", "~1.12.0"] node: ["14.x"] mysql: ["5.7", "8.0"] @@ -29,12 +29,16 @@ jobs: include: - php: "8.1" - symfony: "^5.4" - sylius: "~1.11.2" + symfony: "^6.0" + sylius: "~1.12.0" node: "14.x" mysql: "8.0" pdf: false + exclude: + - symfony: "^6.0" + sylius: "~1.11.2" + env: APP_ENV: test DATABASE_URL: "mysql://root:root@127.0.0.1/sylius?serverVersion=${{ matrix.mysql }}" diff --git a/composer.json b/composer.json index 3e2b5fa4..1a1827ae 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ "myclabs/php-enum": "^1.7", "sylius/resource-bundle": "^1.6", "sylius/sylius": "~1.11.4 || ~1.12.0", - "symfony/messenger": "^5.4" + "symfony/messenger": "^5.4 || ^6.0" }, "require-dev": { "behat/behat": "^3.6", @@ -40,7 +40,6 @@ "friends-of-behat/suite-settings-extension": "^1.0", "friends-of-behat/symfony-extension": "^2.1", "friends-of-behat/variadic-extension": "^1.3", - "friendsofsymfony/oauth-server-bundle": ">2.0.0-alpha.0 ^2.0@dev", "matthiasnoback/symfony-config-test": "^4.0", "matthiasnoback/symfony-dependency-injection-test": "^4.1", "phpspec/phpspec": "^7.0", @@ -49,11 +48,11 @@ "phpunit/phpunit": "^9.5", "polishsymfonycommunity/symfony-mocker-container": "^1.0", "sylius-labs/coding-standard": "~4.0.0", - "symfony/browser-kit": "^5.4", - "symfony/debug-bundle": "^5.4", - "symfony/dotenv": "^5.4", - "symfony/intl": "^5.4", - "symfony/web-profiler-bundle": "^5.4", + "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", "symfony/webpack-encore-bundle": "^1.15", "symplify/easy-coding-standard": "9.3.26" }, @@ -89,5 +88,7 @@ "branch-alias": { "dev-master": "1.0-dev" } - } + }, + "prefer-stable": true, + "minimum-stability": "dev" } diff --git a/src/Resources/config/admin_routing.yml b/src/Resources/config/admin_routing.yml index d6bb58eb..09f54b76 100644 --- a/src/Resources/config/admin_routing.yml +++ b/src/Resources/config/admin_routing.yml @@ -28,7 +28,7 @@ sylius_refund_order_credit_memos_list: path: /orders/{orderId}/credit-memos methods: [GET] defaults: - _controller: sylius_refund.controller.credit_memo:indexAction + _controller: sylius_refund.controller.credit_memo::indexAction _sylius: template: "@SyliusRefundPlugin/Order/Admin/CreditMemo/list.html.twig" repository: @@ -39,7 +39,7 @@ sylius_refund_credit_memo_details: path: /orders/{orderNumber}/credit-memos/{id} methods: [GET] defaults: - _controller: sylius_refund.controller.credit_memo:showAction + _controller: sylius_refund.controller.credit_memo::showAction _sylius: template: "@SyliusRefundPlugin/Order/Admin/CreditMemo/details.html.twig" criteria: diff --git a/src/Resources/config/shop_routing.yml b/src/Resources/config/shop_routing.yml index ea9db89f..0e111f0d 100644 --- a/src/Resources/config/shop_routing.yml +++ b/src/Resources/config/shop_routing.yml @@ -2,7 +2,7 @@ sylius_refund_plugin_shop_order_credit_memos_partial: path: /_partial/orders/{orderId}/credit-memos/ methods: [GET] defaults: - _controller: sylius_refund.controller.credit_memo:indexAction + _controller: sylius_refund.controller.credit_memo::indexAction _sylius: template: "@SyliusRefundPlugin/Order/Shop/_creditMemos.html.twig" repository: diff --git a/tests/Application/config/routes/sylius_shop.yaml b/tests/Application/config/routes/sylius_shop.yaml index 8818568b..9116420d 100644 --- a/tests/Application/config/routes/sylius_shop.yaml +++ b/tests/Application/config/routes/sylius_shop.yaml @@ -11,4 +11,4 @@ sylius_shop_default_locale: path: / methods: [GET] defaults: - _controller: sylius.controller.shop.locale_switch:switchAction + _controller: sylius.controller.shop.locale_switch::switchAction From abf9148bd1f310a51548ed6fc308e95bc335c8c3 Mon Sep 17 00:00:00 2001 From: Kevin Kaniaburka Date: Mon, 17 Oct 2022 11:28:59 +0200 Subject: [PATCH 3/9] [Maintenance] Fix Kernel.php and app configs --- tests/Application/Kernel.php | 12 ++--- .../Application/config/packages/security.yaml | 46 +++++++++---------- .../config/packages/test/framework.yaml | 2 +- .../packages/test_cached/framework.yaml | 6 +-- 4 files changed, 30 insertions(+), 36 deletions(-) diff --git a/tests/Application/Kernel.php b/tests/Application/Kernel.php index 45e06e04..2dcdfde2 100644 --- a/tests/Application/Kernel.php +++ b/tests/Application/Kernel.php @@ -12,7 +12,7 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpKernel\Bundle\BundleInterface; use Symfony\Component\HttpKernel\Kernel as BaseKernel; -use Symfony\Component\Routing\RouteCollectionBuilder; +use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator; final class Kernel extends BaseKernel { @@ -57,7 +57,7 @@ protected function configureContainer(ContainerBuilder $container, LoaderInterfa } } - protected function configureRoutes(RouteCollectionBuilder $routes): void + protected function configureRoutes(RoutingConfigurator $routes): void { foreach ($this->getConfigurationDirectories() as $confDir) { $this->loadRoutesConfiguration($routes, $confDir); @@ -86,11 +86,11 @@ private function loadContainerConfiguration(LoaderInterface $loader, string $con $loader->load($confDir . '/{services}_' . $this->environment . self::CONFIG_EXTS, 'glob'); } - private function loadRoutesConfiguration(RouteCollectionBuilder $routes, string $confDir): void + private function loadRoutesConfiguration(RoutingConfigurator $routes, string $confDir): void { - $routes->import($confDir . '/{routes}/*' . self::CONFIG_EXTS, '/', 'glob'); - $routes->import($confDir . '/{routes}/' . $this->environment . '/**/*' . self::CONFIG_EXTS, '/', 'glob'); - $routes->import($confDir . '/{routes}' . self::CONFIG_EXTS, '/', 'glob'); + $routes->import($confDir . '/{routes}/*' . self::CONFIG_EXTS); + $routes->import($confDir . '/{routes}/' . $this->environment . '/**/*' . self::CONFIG_EXTS); + $routes->import($confDir . '/{routes}' . self::CONFIG_EXTS); } /** diff --git a/tests/Application/config/packages/security.yaml b/tests/Application/config/packages/security.yaml index 8523d577..2f5c6875 100644 --- a/tests/Application/config/packages/security.yaml +++ b/tests/Application/config/packages/security.yaml @@ -1,5 +1,5 @@ security: - always_authenticate_before_granting: true + enable_authenticator_manager: true providers: sylius_admin_user_provider: id: sylius.admin_user_provider.email_or_name_based @@ -10,7 +10,7 @@ security: sylius_api_shop_user_provider: id: sylius.shop_user_provider.email_or_name_based - encoders: + password_hashers: Sylius\Component\User\Model\UserInterface: argon2i firewalls: admin: @@ -26,7 +26,7 @@ security: default_target_path: sylius_admin_dashboard use_forward: false use_referer: true - csrf_token_generator: security.csrf.token_manager + enable_csrf: true csrf_parameter: _csrf_admin_security_token csrf_token_id: admin_authenticate remember_me: @@ -38,37 +38,32 @@ security: logout: path: sylius_admin_logout target: sylius_admin_login - anonymous: true new_api_admin_user: pattern: "%sylius.security.new_api_admin_regex%/.*" provider: sylius_api_admin_user_provider stateless: true - anonymous: 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 - guard: - authenticators: - - lexik_jwt_authentication.jwt_token_authenticator + jwt: true new_api_shop_user: pattern: "%sylius.security.new_api_shop_regex%/.*" provider: sylius_api_shop_user_provider stateless: true - anonymous: 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 - guard: - authenticators: - - lexik_jwt_authentication.jwt_token_authenticator + jwt: true shop: switch_user: { role: ROLE_ALLOWED_TO_SWITCH } @@ -85,7 +80,7 @@ security: default_target_path: sylius_shop_homepage use_forward: false use_referer: true - csrf_token_generator: security.csrf.token_manager + enable_csrf: true csrf_parameter: _csrf_shop_security_token csrf_token_id: shop_authenticate remember_me: @@ -95,32 +90,33 @@ security: remember_me_parameter: _remember_me logout: path: sylius_shop_logout - target: sylius_shop_login + target: sylius_shop_homepage 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: 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: IS_AUTHENTICATED_ANONYMOUSLY, ips: [127.0.0.1, ::1] } + - { 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: IS_AUTHENTICATED_ANONYMOUSLY } - - { path: "%sylius.security.shop_regex%/login", role: IS_AUTHENTICATED_ANONYMOUSLY } + - { path: "%sylius.security.admin_regex%/forgotten-password", role: PUBLIC_ACCESS } - - { 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%/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: IS_AUTHENTICATED_ANONYMOUSLY } + - { 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: IS_AUTHENTICATED_ANONYMOUSLY } - - { path: "%sylius.security.new_api_shop_regex%/.*", role: IS_AUTHENTICATED_ANONYMOUSLY } + - { 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/packages/test/framework.yaml b/tests/Application/config/packages/test/framework.yaml index 76d7e5e1..fc1d3c13 100644 --- a/tests/Application/config/packages/test/framework.yaml +++ b/tests/Application/config/packages/test/framework.yaml @@ -1,4 +1,4 @@ framework: test: ~ session: - storage_id: session.storage.mock_file + storage_factory_id: session.storage.factory.mock_file diff --git a/tests/Application/config/packages/test_cached/framework.yaml b/tests/Application/config/packages/test_cached/framework.yaml index 76d7e5e1..7c6483dd 100644 --- a/tests/Application/config/packages/test_cached/framework.yaml +++ b/tests/Application/config/packages/test_cached/framework.yaml @@ -1,4 +1,2 @@ -framework: - test: ~ - session: - storage_id: session.storage.mock_file +imports: + - { resource: "../test/framework.yaml" } From 5483b164ef2f9561db463bd17dc16b3bbe199da6 Mon Sep 17 00:00:00 2001 From: Kevin Kaniaburka Date: Mon, 17 Oct 2022 11:38:25 +0200 Subject: [PATCH 4/9] [Maintenance] Adjust services to Sylius 6 --- phpstan.neon | 1 + src/Action/Admin/OrderRefundsListAction.php | 48 +++++++++----------- src/Action/Admin/RefundUnitsAction.php | 49 ++++++++++----------- src/Action/Admin/SendCreditMemoAction.php | 35 +++++++-------- src/Action/CompleteRefundPaymentAction.php | 43 +++++++++--------- src/Resources/config/services/actions.xml | 8 ++-- 6 files changed, 89 insertions(+), 95 deletions(-) diff --git a/phpstan.neon b/phpstan.neon index 0528eca5..7a74bdcc 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -19,3 +19,4 @@ parameters: - '/Method Sylius\\RefundPlugin\\Entity\\CustomerBillingData::setId\(\) has parameter \$id with no typehint specified./' - '/Method Sylius\\RefundPlugin\\Entity\\CustomerBillingDataInterface::id\(\) has no return typehint specified./' - '/Method Sylius\\RefundPlugin\\Entity\\CustomerBillingDataInterface::setId\(\) has parameter \$id with no typehint specified./' + - '/Method Sylius\\RefundPlugin\\[a-zA-Z\\]+::getFlashBag\(\) should return Symfony\\Component\\HttpFoundation\\Session\\Flash\\FlashBagInterface but returns Symfony\\Component\\HttpFoundation\\Session\\SessionBagInterface\./' diff --git a/src/Action/Admin/OrderRefundsListAction.php b/src/Action/Admin/OrderRefundsListAction.php index aef528f6..9c476a77 100644 --- a/src/Action/Admin/OrderRefundsListAction.php +++ b/src/Action/Admin/OrderRefundsListAction.php @@ -20,40 +20,27 @@ use Sylius\RefundPlugin\Provider\RefundPaymentMethodsProviderInterface; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpFoundation\Session\Session; +use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface; +use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Twig\Environment; use Webmozart\Assert\Assert; final class OrderRefundsListAction { - private OrderRepositoryInterface $orderRepository; - - private OrderRefundingAvailabilityCheckerInterface $orderRefundsListAvailabilityChecker; - - private RefundPaymentMethodsProviderInterface $refundPaymentMethodsProvider; - - private Environment $twig; - - private Session $session; - - private UrlGeneratorInterface $router; - public function __construct( - OrderRepositoryInterface $orderRepository, - OrderRefundingAvailabilityCheckerInterface $orderRefundsListAvailabilityChecker, - RefundPaymentMethodsProviderInterface $refundPaymentMethodsProvider, - Environment $twig, - Session $session, - UrlGeneratorInterface $router + private OrderRepositoryInterface $orderRepository, + private OrderRefundingAvailabilityCheckerInterface $orderRefundsListAvailabilityChecker, + private RefundPaymentMethodsProviderInterface $refundPaymentMethodsProvider, + private Environment $twig, + private SessionInterface | RequestStack $requestStackOrSession, + private UrlGeneratorInterface $router, ) { - $this->orderRepository = $orderRepository; - $this->orderRefundsListAvailabilityChecker = $orderRefundsListAvailabilityChecker; - $this->refundPaymentMethodsProvider = $refundPaymentMethodsProvider; - $this->twig = $twig; - $this->session = $session; - $this->router = $router; + if ($this->requestStackOrSession instanceof SessionInterface) { + trigger_deprecation('sylius/refund-plugin', '1.3', sprintf('Passing an instance of %s as constructor argument for %s is deprecated as of Sylius Refund Plugin 1.3 and will be removed in 2.0. Pass an instance of %s instead.', SessionInterface::class, self::class, RequestStack::class)); + } } public function __invoke(Request $request): Response @@ -83,8 +70,17 @@ public function __invoke(Request $request): Response private function redirectToReferer(OrderInterface $order, string $message): Response { - $this->session->getFlashBag()->add('error', $message); + $this->getFlashBag()->add('error', $message); return new RedirectResponse($this->router->generate('sylius_admin_order_show', ['id' => $order->getId()])); } + + private function getFlashBag(): FlashBagInterface + { + if ($this->requestStackOrSession instanceof RequestStack) { + return $this->requestStackOrSession->getSession()->getBag('flashes'); + } + + return $this->requestStackOrSession->getBag('flashes'); + } } diff --git a/src/Action/Admin/RefundUnitsAction.php b/src/Action/Admin/RefundUnitsAction.php index b6bee6ec..146acd02 100644 --- a/src/Action/Admin/RefundUnitsAction.php +++ b/src/Action/Admin/RefundUnitsAction.php @@ -18,36 +18,26 @@ use Sylius\RefundPlugin\Exception\InvalidRefundAmount; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpFoundation\Session\Session; +use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface; +use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\Messenger\Exception\HandlerFailedException; use Symfony\Component\Messenger\MessageBusInterface; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; final class RefundUnitsAction { - private MessageBusInterface $commandBus; - - private Session $session; - - private UrlGeneratorInterface $router; - - private RefundUnitsCommandCreatorInterface $commandCreator; - - private LoggerInterface $logger; - public function __construct( - MessageBusInterface $commandBus, - Session $session, - UrlGeneratorInterface $router, - RefundUnitsCommandCreatorInterface $commandCreator, - LoggerInterface $logger + private MessageBusInterface $commandBus, + private SessionInterface | RequestStack $requestStackOrSession, + private UrlGeneratorInterface $router, + private RefundUnitsCommandCreatorInterface $commandCreator, + private LoggerInterface $logger ) { - $this->commandBus = $commandBus; - $this->session = $session; - $this->router = $router; - $this->commandCreator = $commandCreator; - $this->logger = $logger; + if ($this->requestStackOrSession instanceof SessionInterface) { + trigger_deprecation('sylius/refund-plugin', '1.3', sprintf('Passing an instance of %s as constructor argument for %s is deprecated as of Sylius Refund Plugin 1.3 and will be removed in 2.0. Pass an instance of %s instead.', SessionInterface::class, self::class, RequestStack::class)); + } } public function __invoke(Request $request): Response @@ -55,9 +45,9 @@ public function __invoke(Request $request): Response try { $this->commandBus->dispatch($this->commandCreator->fromRequest($request)); - $this->session->getFlashBag()->add('success', 'sylius_refund.units_successfully_refunded'); + $this->getFlashBag()->add('success', 'sylius_refund.units_successfully_refunded'); } catch (InvalidRefundAmount $exception) { - $this->session->getFlashBag()->add('error', $exception->getMessage()); + $this->getFlashBag()->add('error', $exception->getMessage()); $this->logger->error($exception->getMessage()); } catch (HandlerFailedException $exception) { @@ -78,11 +68,20 @@ public function __invoke(Request $request): Response private function provideErrorMessage(\Throwable $previousException): void { if ($previousException instanceof InvalidRefundAmount) { - $this->session->getFlashBag()->add('error', $previousException->getMessage()); + $this->getFlashBag()->add('error', $previousException->getMessage()); return; } - $this->session->getFlashBag()->add('error', 'sylius_refund.error_occurred'); + $this->getFlashBag()->add('error', 'sylius_refund.error_occurred'); + } + + private function getFlashBag(): FlashBagInterface + { + if ($this->requestStackOrSession instanceof RequestStack) { + return $this->requestStackOrSession->getSession()->getBag('flashes'); + } + + return $this->requestStackOrSession->getBag('flashes'); } } diff --git a/src/Action/Admin/SendCreditMemoAction.php b/src/Action/Admin/SendCreditMemoAction.php index a47c66b6..ff02d31b 100644 --- a/src/Action/Admin/SendCreditMemoAction.php +++ b/src/Action/Admin/SendCreditMemoAction.php @@ -18,32 +18,22 @@ use Sylius\RefundPlugin\Entity\CreditMemoInterface; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpFoundation\Session\Session; +use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface; +use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\Messenger\MessageBusInterface; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Webmozart\Assert\Assert; final class SendCreditMemoAction { - private MessageBusInterface $commandBus; - - private RepositoryInterface $creditMemoRepository; - - private Session $session; - - private UrlGeneratorInterface $router; - public function __construct( - MessageBusInterface $commandBus, - RepositoryInterface $creditMemoRepository, - Session $session, - UrlGeneratorInterface $router + private MessageBusInterface $commandBus, + private RepositoryInterface $creditMemoRepository, + private SessionInterface | RequestStack $requestStackOrSession, + private UrlGeneratorInterface $router ) { - $this->commandBus = $commandBus; - $this->creditMemoRepository = $creditMemoRepository; - $this->session = $session; - $this->router = $router; } public function __invoke(Request $request): Response @@ -65,8 +55,17 @@ public function __invoke(Request $request): Response public function addFlashAndRedirect(string $flashType, string $message): RedirectResponse { - $this->session->getFlashBag()->add($flashType, $message); + $this->getFlashBag()->add($flashType, $message); return new RedirectResponse($this->router->generate('sylius_refund_admin_credit_memo_index')); } + + private function getFlashBag(): FlashBagInterface + { + if ($this->requestStackOrSession instanceof RequestStack) { + return $this->requestStackOrSession->getSession()->getBag('flashes'); + } + + return $this->requestStackOrSession->getBag('flashes'); + } } diff --git a/src/Action/CompleteRefundPaymentAction.php b/src/Action/CompleteRefundPaymentAction.php index 3b132fb2..dd48d17f 100644 --- a/src/Action/CompleteRefundPaymentAction.php +++ b/src/Action/CompleteRefundPaymentAction.php @@ -20,34 +20,24 @@ use Sylius\RefundPlugin\StateResolver\RefundPaymentCompletedStateApplierInterface; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpFoundation\Session\Session; +use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface; +use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\Routing\RouterInterface; final class CompleteRefundPaymentAction { - private Session $session; - - private ObjectRepository $refundPaymentRepository; - - private RefundPaymentCompletedStateApplierInterface $refundPaymentCompletedStateApplier; - - private RouterInterface $router; - - private OrderRepositoryInterface $orderRepository; - public function __construct( - Session $session, - ObjectRepository $refundPaymentInterface, - OrderRepositoryInterface $orderRepository, - RefundPaymentCompletedStateApplierInterface $refundPaymentCompletedStateApplier, - RouterInterface $router + private SessionInterface | RequestStack $requestStackOrSession, + private ObjectRepository $refundPaymentRepository, + private OrderRepositoryInterface $orderRepository, + private RefundPaymentCompletedStateApplierInterface $refundPaymentCompletedStateApplier, + private RouterInterface $router ) { - $this->session = $session; - $this->refundPaymentRepository = $refundPaymentInterface; - $this->refundPaymentCompletedStateApplier = $refundPaymentCompletedStateApplier; - $this->router = $router; - $this->orderRepository = $orderRepository; + if ($this->requestStackOrSession instanceof SessionInterface) { + trigger_deprecation('sylius/refund-plugin', '1.3', sprintf('Passing an instance of %s as constructor argument for %s is deprecated as of Sylius Refund Plugin 1.3 and will be removed in 2.0. Pass an instance of %s instead.', SessionInterface::class, self::class, RequestStack::class)); + } } public function __invoke(Request $request, string $orderNumber, string $id): Response @@ -57,7 +47,7 @@ public function __invoke(Request $request, string $orderNumber, string $id): Res $this->refundPaymentCompletedStateApplier->apply($refundPayment); - $this->session->getFlashBag()->add('success', 'sylius_refund.refund_payment_completed'); + $this->getFlashBag()->add('success', 'sylius_refund.refund_payment_completed'); /** @var OrderInterface $order */ $order = $this->orderRepository->findOneByNumber($orderNumber); @@ -67,4 +57,13 @@ public function __invoke(Request $request, string $orderNumber, string $id): Res ['id' => $order->getId()] )); } + + private function getFlashBag(): FlashBagInterface + { + if ($this->requestStackOrSession instanceof RequestStack) { + return $this->requestStackOrSession->getSession()->getBag('flashes'); + } + + return $this->requestStackOrSession->getBag('flashes'); + } } diff --git a/src/Resources/config/services/actions.xml b/src/Resources/config/services/actions.xml index b68c49c8..82eeaa7e 100644 --- a/src/Resources/config/services/actions.xml +++ b/src/Resources/config/services/actions.xml @@ -22,20 +22,20 @@ - + - + - + @@ -45,7 +45,7 @@ - + From 006c863e6147a01144cf6d81377076b065c75752 Mon Sep 17 00:00:00 2001 From: Kevin Kaniaburka Date: Mon, 17 Oct 2022 12:29:13 +0200 Subject: [PATCH 5/9] [Maintenance] Fix deprecated services definitions --- src/Resources/config/services.xml | 6 +++--- src/Resources/config/services/checkers.xml | 6 +++--- src/Resources/config/services/creators.xml | 4 ++-- src/Resources/config/services/factories.xml | 2 +- src/Resources/config/services/generators.xml | 8 ++++---- src/Resources/config/services/providers.xml | 8 ++++---- src/Resources/config/services/state_resolvers.xml | 6 +++--- src/Resources/config/services/validators.xml | 4 ++-- 8 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/Resources/config/services.xml b/src/Resources/config/services.xml index c1efc939..bac075c3 100644 --- a/src/Resources/config/services.xml +++ b/src/Resources/config/services.xml @@ -20,7 +20,7 @@ - The "%alias_id%" service alias is deprecated and will be removed in RefundPlugin 1.0, use Sylius\RefundPlugin\Calculator\UnitRefundTotalCalculatorInterface instead. + The "%alias_id%" service alias is deprecated and will be removed in RefundPlugin 2.0, use Sylius\RefundPlugin\Calculator\UnitRefundTotalCalculatorInterface instead. @@ -57,14 +57,14 @@ - The "%alias_id%" service alias is deprecated and will be removed in RefundPlugin 1.0, use Sylius\RefundPlugin\Sender\CreditMemoEmailSenderInterface instead. + The "%alias_id%" service alias is deprecated and will be removed in RefundPlugin 2.0, use Sylius\RefundPlugin\Sender\CreditMemoEmailSenderInterface instead. - The "%alias_id%" service alias is deprecated and will be removed in RefundPlugin 1.0, use Sylius\RefundPlugin\ResponseBuilder\CreditMemoFileResponseBuilderInterface instead. + The "%alias_id%" service alias is deprecated and will be removed in RefundPlugin 2.0, use Sylius\RefundPlugin\ResponseBuilder\CreditMemoFileResponseBuilderInterface instead. diff --git a/src/Resources/config/services/checkers.xml b/src/Resources/config/services/checkers.xml index cedf4f62..9cc755c6 100644 --- a/src/Resources/config/services/checkers.xml +++ b/src/Resources/config/services/checkers.xml @@ -12,7 +12,7 @@ - The "%alias_id%" service alias is deprecated and will be removed in RefundPlugin 1.0, use Sylius\RefundPlugin\Checker\CreditMemoCustomerRelationCheckerInterface instead. + The "%alias_id%" service alias is deprecated and will be removed in RefundPlugin 2.0, use Sylius\RefundPlugin\Checker\CreditMemoCustomerRelationCheckerInterface instead. @@ -27,14 +27,14 @@ - The "%alias_id%" service alias is deprecated and will be removed in RefundPlugin 1.0, use Sylius\RefundPlugin\Checker\OrderFullyRefundedTotalCheckerInterface instead. + The "%alias_id%" service alias is deprecated and will be removed in RefundPlugin 2.0, use Sylius\RefundPlugin\Checker\OrderFullyRefundedTotalCheckerInterface instead. - The "%alias_id%" service alias is deprecated and will be removed in RefundPlugin 1.0, use Sylius\RefundPlugin\Checker\UnitRefundingAvailabilityCheckerInterface instead. + The "%alias_id%" service alias is deprecated and will be removed in RefundPlugin 2.0, use Sylius\RefundPlugin\Checker\UnitRefundingAvailabilityCheckerInterface instead. diff --git a/src/Resources/config/services/creators.xml b/src/Resources/config/services/creators.xml index 9ec3802d..dba5e608 100644 --- a/src/Resources/config/services/creators.xml +++ b/src/Resources/config/services/creators.xml @@ -14,14 +14,14 @@ - The "%alias_id%" service alias is deprecated and will be removed in RefundPlugin 1.0, use Sylius\RefundPlugin\Creator\RefundCreatorInterface instead. + The "%alias_id%" service alias is deprecated and will be removed in RefundPlugin 2.0, use Sylius\RefundPlugin\Creator\RefundCreatorInterface instead. - The "%alias_id%" service alias is deprecated and will be removed in RefundPlugin 1.0, use Sylius\RefundPlugin\Creator\RefundUnitsCommandCreatorInterface instead. + The "%alias_id%" service alias is deprecated and will be removed in RefundPlugin 2.0, use Sylius\RefundPlugin\Creator\RefundUnitsCommandCreatorInterface instead. diff --git a/src/Resources/config/services/factories.xml b/src/Resources/config/services/factories.xml index 34f26f70..26154746 100644 --- a/src/Resources/config/services/factories.xml +++ b/src/Resources/config/services/factories.xml @@ -9,7 +9,7 @@ - The "%alias_id%" service alias is deprecated and will be removed in RefundPlugin 1.0, use Sylius\RefundPlugin\Factory\CreditMemoSequenceFactoryInterface instead. + The "%alias_id%" service alias is deprecated and will be removed in RefundPlugin 2.0, use Sylius\RefundPlugin\Factory\CreditMemoSequenceFactoryInterface instead. diff --git a/src/Resources/config/services/generators.xml b/src/Resources/config/services/generators.xml index f2e85d4a..40e833e1 100644 --- a/src/Resources/config/services/generators.xml +++ b/src/Resources/config/services/generators.xml @@ -13,7 +13,7 @@ - The "%alias_id%" service alias is deprecated and will be removed in RefundPlugin 1.0, use Sylius\RefundPlugin\Generator\CreditMemoNumberGeneratorInterface instead. + The "%alias_id%" service alias is deprecated and will be removed in RefundPlugin 2.0, use Sylius\RefundPlugin\Generator\CreditMemoNumberGeneratorInterface instead. @@ -26,7 +26,7 @@ - The "%alias_id%" service alias is deprecated and will be removed in RefundPlugin 1.0, use Sylius\RefundPlugin\Generator\CreditMemoGeneratorInterface instead. + The "%alias_id%" service alias is deprecated and will be removed in RefundPlugin 2.0, use Sylius\RefundPlugin\Generator\CreditMemoGeneratorInterface instead. - The "%alias_id%" service alias is deprecated and will be removed in RefundPlugin 1.0, use Sylius\RefundPlugin\Generator\CreditMemoPdfFileGeneratorInterface instead. + The "%alias_id%" service alias is deprecated and will be removed in RefundPlugin 2.0, use Sylius\RefundPlugin\Generator\CreditMemoPdfFileGeneratorInterface instead. - The "%alias_id%" service alias is deprecated and will be removed in RefundPlugin 1.0, use Sylius\RefundPlugin\Generator\CreditMemoIdentifierGeneratorInterface instead. + The "%alias_id%" service alias is deprecated and will be removed in RefundPlugin 2.0, use Sylius\RefundPlugin\Generator\CreditMemoIdentifierGeneratorInterface instead. diff --git a/src/Resources/config/services/providers.xml b/src/Resources/config/services/providers.xml index 78636833..41b6f2d1 100644 --- a/src/Resources/config/services/providers.xml +++ b/src/Resources/config/services/providers.xml @@ -22,7 +22,7 @@ - The "%alias_id%" service alias is deprecated and will be removed in RefundPlugin 1.0, use Sylius\RefundPlugin\Provider\RefundedShipmentFeeProviderInterface instead. + The "%alias_id%" service alias is deprecated and will be removed in RefundPlugin 2.0, use Sylius\RefundPlugin\Provider\RefundedShipmentFeeProviderInterface instead. @@ -30,7 +30,7 @@ - The "%alias_id%" service alias is deprecated and will be removed in RefundPlugin 1.0, use Sylius\RefundPlugin\Provider\OrderRefundedTotalProviderInterface instead. + The "%alias_id%" service alias is deprecated and will be removed in RefundPlugin 2.0, use Sylius\RefundPlugin\Provider\OrderRefundedTotalProviderInterface instead. - The "%alias_id%" service alias is deprecated and will be removed in RefundPlugin 1.0, use Sylius\RefundPlugin\Provider\RemainingTotalProviderInterface instead. + The "%alias_id%" service alias is deprecated and will be removed in RefundPlugin 2.0, use Sylius\RefundPlugin\Provider\RemainingTotalProviderInterface instead. - The "%alias_id%" service alias is deprecated and will be removed in RefundPlugin 1.0, use Sylius\RefundPlugin\Provider\UnitRefundedTotalProviderInterface instead. + The "%alias_id%" service alias is deprecated and will be removed in RefundPlugin 2.0, use Sylius\RefundPlugin\Provider\UnitRefundedTotalProviderInterface instead. - The "%alias_id%" service alias is deprecated and will be removed in RefundPlugin 1.0, use Sylius\RefundPlugin\StateResolver\OrderFullyRefundedStateResolverInterface instead. + The "%alias_id%" service alias is deprecated and will be removed in RefundPlugin 2.0, use Sylius\RefundPlugin\StateResolver\OrderFullyRefundedStateResolverInterface instead. @@ -23,7 +23,7 @@ - The "%alias_id%" service alias is deprecated and will be removed in RefundPlugin 1.0, use Sylius\RefundPlugin\StateResolver\OrderPartiallyRefundedStateResolverInterface instead. + The "%alias_id%" service alias is deprecated and will be removed in RefundPlugin 2.0, use Sylius\RefundPlugin\StateResolver\OrderPartiallyRefundedStateResolverInterface instead. @@ -31,7 +31,7 @@ - The "%alias_id%" service alias is deprecated and will be removed in RefundPlugin 1.0, use Sylius\RefundPlugin\StateResolver\RefundPaymentCompletedStateApplierInterface instead. + The "%alias_id%" service alias is deprecated and will be removed in RefundPlugin 2.0, use Sylius\RefundPlugin\StateResolver\RefundPaymentCompletedStateApplierInterface instead. diff --git a/src/Resources/config/services/validators.xml b/src/Resources/config/services/validators.xml index 59c9703e..c33aea2e 100644 --- a/src/Resources/config/services/validators.xml +++ b/src/Resources/config/services/validators.xml @@ -12,14 +12,14 @@ - The "%alias_id%" service alias is deprecated and will be removed in RefundPlugin 1.0, use Sylius\RefundPlugin\Validator\RefundUnitsCommandValidatorInterface instead. + The "%alias_id%" service alias is deprecated and will be removed in RefundPlugin 2.0, use Sylius\RefundPlugin\Validator\RefundUnitsCommandValidatorInterface instead. - The "%alias_id%" service alias is deprecated and will be removed in RefundPlugin 1.0, use Sylius\RefundPlugin\Validator\RefundAmountValidatorInterface instead. + The "%alias_id%" service alias is deprecated and will be removed in RefundPlugin 2.0, use Sylius\RefundPlugin\Validator\RefundAmountValidatorInterface instead. From 726ccf174430f7d5487eabec21359394a56ab1e7 Mon Sep 17 00:00:00 2001 From: Kevin Kaniaburka Date: Mon, 17 Oct 2022 13:44:12 +0200 Subject: [PATCH 6/9] [Maintenance] Upgrade PHPStan packages --- .github/workflows/build.yml | 2 +- composer.json | 7 +++++-- phpstan.neon | 12 +++++++----- src/Converter/RefundUnitsConverter.php | 6 +++++- src/Factory/RefundFactory.php | 6 +++++- src/Factory/RefundPaymentFactory.php | 6 +++++- src/Factory/RefundTypeFactory.php | 6 +++++- 7 files changed, 33 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 472441a7..8498abf9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -187,7 +187,7 @@ jobs: - name: Run PHPStan - run: vendor/bin/phpstan analyse -c phpstan.neon -l max src/ + run: vendor/bin/phpstan analyse -c phpstan.neon src/ - name: Run PHPSpec diff --git a/composer.json b/composer.json index 1a1827ae..ebc15b7b 100644 --- a/composer.json +++ b/composer.json @@ -43,8 +43,8 @@ "matthiasnoback/symfony-config-test": "^4.0", "matthiasnoback/symfony-dependency-injection-test": "^4.1", "phpspec/phpspec": "^7.0", - "phpstan/phpstan": "0.12.96", - "phpstan/phpstan-webmozart-assert": "0.12.12", + "phpstan/phpstan": "1.5.4", + "phpstan/phpstan-webmozart-assert": "1.1.2", "phpunit/phpunit": "^9.5", "polishsymfonycommunity/symfony-mocker-container": "^1.0", "sylius-labs/coding-standard": "~4.0.0", @@ -87,6 +87,9 @@ "extra": { "branch-alias": { "dev-master": "1.0-dev" + }, + "symfony": { + "require": "^6.0" } }, "prefer-stable": true, diff --git a/phpstan.neon b/phpstan.neon index 7a74bdcc..ae958b45 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -2,6 +2,8 @@ includes: - vendor/phpstan/phpstan-webmozart-assert/extension.neon parameters: + level: 8 + checkMissingIterableValueType: false checkGenericClassInNonGenericObjectType: false @@ -14,9 +16,9 @@ parameters: - 'tests/Application/src/**.php' ignoreErrors: - - '/Method Sylius\\RefundPlugin\\Entity\\CustomerBillingData::id\(\) has no return typehint specified./' - - '/Method Sylius\\RefundPlugin\\Entity\\CustomerBillingData::getId\(\) has no return typehint specified./' - - '/Method Sylius\\RefundPlugin\\Entity\\CustomerBillingData::setId\(\) has parameter \$id with no typehint specified./' - - '/Method Sylius\\RefundPlugin\\Entity\\CustomerBillingDataInterface::id\(\) has no return typehint specified./' - - '/Method Sylius\\RefundPlugin\\Entity\\CustomerBillingDataInterface::setId\(\) has parameter \$id with no typehint specified./' + - '/Method Sylius\\RefundPlugin\\Entity\\CustomerBillingData::id\(\) has no return type specified./' + - '/Method Sylius\\RefundPlugin\\Entity\\CustomerBillingData::getId\(\) has no return type specified./' + - '/Method Sylius\\RefundPlugin\\Entity\\CustomerBillingData::setId\(\) has parameter \$id with no type specified./' + - '/Method Sylius\\RefundPlugin\\Entity\\CustomerBillingDataInterface::id\(\) has no return type specified./' + - '/Method Sylius\\RefundPlugin\\Entity\\CustomerBillingDataInterface::setId\(\) has parameter \$id with no type specified./' - '/Method Sylius\\RefundPlugin\\[a-zA-Z\\]+::getFlashBag\(\) should return Symfony\\Component\\HttpFoundation\\Session\\Flash\\FlashBagInterface but returns Symfony\\Component\\HttpFoundation\\Session\\SessionBagInterface\./' diff --git a/src/Converter/RefundUnitsConverter.php b/src/Converter/RefundUnitsConverter.php index 9891ee4e..93d2ce63 100644 --- a/src/Converter/RefundUnitsConverter.php +++ b/src/Converter/RefundUnitsConverter.php @@ -15,6 +15,7 @@ use Sylius\RefundPlugin\Calculator\UnitRefundTotalCalculatorInterface; use Sylius\RefundPlugin\Model\RefundTypeInterface; +use Sylius\RefundPlugin\Model\UnitRefundInterface; use Webmozart\Assert\Assert; final class RefundUnitsConverter implements RefundUnitsConverterInterface @@ -36,7 +37,10 @@ public function convert(array $units, RefundTypeInterface $refundType, string $u ->calculateForUnitWithIdAndType($id, $refundType, $this->getAmount($unit)) ; - $refundUnits[] = new $unitRefundClass((int) $id, $total); + $unitRefund = new $unitRefundClass((int) $id, $total); + Assert::isInstanceOf($unitRefund, UnitRefundInterface::class); + + $refundUnits[] = $unitRefund; } return $refundUnits; diff --git a/src/Factory/RefundFactory.php b/src/Factory/RefundFactory.php index 195c5cfc..dd610573 100644 --- a/src/Factory/RefundFactory.php +++ b/src/Factory/RefundFactory.php @@ -16,6 +16,7 @@ use Sylius\Component\Core\Model\OrderInterface; use Sylius\RefundPlugin\Entity\RefundInterface; use Sylius\RefundPlugin\Model\RefundTypeInterface; +use Webmozart\Assert\Assert; final class RefundFactory implements RefundFactoryInterface { @@ -33,6 +34,9 @@ public function createNew(): RefundInterface public function createWithData(OrderInterface $order, int $unitId, int $amount, RefundTypeInterface $type): RefundInterface { - return new $this->className($order, $amount, $unitId, $type); + $refund = new $this->className($order, $amount, $unitId, $type); + Assert::isInstanceOf($refund, RefundInterface::class); + + return $refund; } } diff --git a/src/Factory/RefundPaymentFactory.php b/src/Factory/RefundPaymentFactory.php index 2454e514..433e0a53 100644 --- a/src/Factory/RefundPaymentFactory.php +++ b/src/Factory/RefundPaymentFactory.php @@ -16,6 +16,7 @@ use Sylius\Component\Core\Model\OrderInterface; use Sylius\Component\Core\Model\PaymentMethodInterface; use Sylius\RefundPlugin\Entity\RefundPaymentInterface; +use Webmozart\Assert\Assert; final class RefundPaymentFactory implements RefundPaymentFactoryInterface { @@ -38,6 +39,9 @@ public function createWithData( string $state, PaymentMethodInterface $paymentMethod ): RefundPaymentInterface { - return new $this->className($order, $amount, $currencyCode, $state, $paymentMethod); + $refundPayment = new $this->className($order, $amount, $currencyCode, $state, $paymentMethod); + Assert::isInstanceOf($refundPayment, RefundPaymentInterface::class); + + return $refundPayment; } } diff --git a/src/Factory/RefundTypeFactory.php b/src/Factory/RefundTypeFactory.php index c961dec2..062760c2 100644 --- a/src/Factory/RefundTypeFactory.php +++ b/src/Factory/RefundTypeFactory.php @@ -14,6 +14,7 @@ namespace Sylius\RefundPlugin\Factory; use Sylius\RefundPlugin\Model\RefundTypeInterface; +use Webmozart\Assert\Assert; final class RefundTypeFactory implements RefundTypeFactoryInterface { @@ -26,6 +27,9 @@ public function __construct(string $className) public function createNew(string $refundType): RefundTypeInterface { - return new $this->className($refundType); + $refundType = new $this->className($refundType); + Assert::isInstanceOf($refundType, RefundTypeInterface::class); + + return $refundType; } } From 6ca616b33639731ef2533af0ac3717b464335937 Mon Sep 17 00:00:00 2001 From: Grzegorz Sadowski Date: Fri, 4 Nov 2022 07:34:40 +0100 Subject: [PATCH 7/9] [GitHub Actions] Bump node version --- .github/workflows/build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8498abf9..91af74cf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,8 +21,8 @@ jobs: matrix: php: ["8.0", "8.1"] symfony: ["^5.4", "^6.0"] - sylius: ["~1.11.2", "~1.12.0"] - node: ["14.x"] + sylius: ["~1.11.4", "~1.12.0"] + node: ["16.x"] mysql: ["5.7", "8.0"] pdf: [true] @@ -31,13 +31,13 @@ jobs: php: "8.1" symfony: "^6.0" sylius: "~1.12.0" - node: "14.x" + node: "16.x" mysql: "8.0" pdf: false exclude: - symfony: "^6.0" - sylius: "~1.11.2" + sylius: "~1.11.4" env: APP_ENV: test From e79164aebc266c837f0fc24ae1d2ae5195841319 Mon Sep 17 00:00:00 2001 From: Grzegorz Sadowski Date: Fri, 4 Nov 2022 07:36:51 +0100 Subject: [PATCH 8/9] Add missing deprecation --- src/Action/Admin/SendCreditMemoAction.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Action/Admin/SendCreditMemoAction.php b/src/Action/Admin/SendCreditMemoAction.php index ff02d31b..62fca012 100644 --- a/src/Action/Admin/SendCreditMemoAction.php +++ b/src/Action/Admin/SendCreditMemoAction.php @@ -34,6 +34,9 @@ public function __construct( private SessionInterface | RequestStack $requestStackOrSession, private UrlGeneratorInterface $router ) { + if ($this->requestStackOrSession instanceof SessionInterface) { + trigger_deprecation('sylius/refund-plugin', '1.3', sprintf('Passing an instance of %s as constructor argument for %s is deprecated as of Sylius Refund Plugin 1.3 and will be removed in 2.0. Pass an instance of %s instead.', SessionInterface::class, self::class, RequestStack::class)); + } } public function __invoke(Request $request): Response From fb143243cfebff1a173cb3916d43abfa8691924b Mon Sep 17 00:00:00 2001 From: Kevin Kaniaburka Date: Mon, 7 Nov 2022 15:36:42 +0100 Subject: [PATCH 9/9] [GitHub Actions] Add more elements to the matrix --- .github/workflows/build.yml | 7 +++++++ composer.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 91af74cf..8c13cf7f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -34,6 +34,13 @@ jobs: node: "16.x" mysql: "8.0" pdf: false + - + php: "8.1" + symfony: "^5.4" + sylius: "~1.11.2" + node: "14.x" + mysql: "8.0" + pdf: false exclude: - symfony: "^6.0" diff --git a/composer.json b/composer.json index ebc15b7b..37841ae4 100644 --- a/composer.json +++ b/composer.json @@ -89,7 +89,7 @@ "dev-master": "1.0-dev" }, "symfony": { - "require": "^6.0" + "require": "^5.4 || ^6.0" } }, "prefer-stable": true,