Skip to content

[XML2PHP] PayumBundle#18768

Merged
TheMilek merged 1 commit intoSylius:2.3from
crydotsnake:xml2php/payum
Feb 4, 2026
Merged

[XML2PHP] PayumBundle#18768
TheMilek merged 1 commit intoSylius:2.3from
crydotsnake:xml2php/payum

Conversation

@crydotsnake
Copy link
Copy Markdown
Member

@crydotsnake crydotsnake commented Jan 31, 2026

Q A
Branch? 2.3
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Related tickets partially #18490
License MIT

Summary by CodeRabbit

  • Chores

    • Migrated Payum bundle DI from XML to PHP and switched the loader to consume PHP configs.
    • Added "tagged_locator" to the dependency checker whitelist.
  • New Features

    • Registered numerous Payum services: HTTP client, actions, factories, extensions, processors, command handlers/providers, resolvers, context, form type extensions, and shop integration providers.
  • Style

    • Consolidated integration imports and standardized PHP-based configuration.

@crydotsnake crydotsnake requested review from a team as code owners January 31, 2026 11:24
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Jan 31, 2026

📝 Walkthrough

Walkthrough

Convert PayumBundle service configuration from XML to PHP: replace XmlFileLoader with PhpFileLoader in the bundle extension, add new PHP service config files (many under Resources/config and subfolders), remove corresponding XML files, and add tagged_locator to composer-require-checker.json. No public PHP signatures changed.

Changes

Cohort / File(s) Summary
Bootstrap / Whitelist
composer-require-checker.json, src/Sylius/Bundle/PayumBundle/DependencyInjection/SyliusPayumExtension.php
Add tagged_locator to composer-require-checker.json; switch DI loader from XmlFileLoaderPhpFileLoader and change imported resources from .xml.php.
Root DI
src/Sylius/Bundle/PayumBundle/Resources/config/services.php, src/Sylius/Bundle/PayumBundle/Resources/config/services.xml
Add services.php (registers sylius_payum.http_client), remove services.xml.
Actions (general & payment_request)
.../services/action.php, .../services/action.xml, .../payment_request/action.php, .../payment_request/action.xml
Move Payum action service definitions (authorize, capture, execute, resolve next route, offline variants, payment_request actions) from XML to PHP with tags preserved.
Checkers / Extensions / Factories
.../services/checker.php, .../services/checker.xml, .../services/extension.php, .../services/extension.xml, .../services/factory.php, .../services/factory.xml
Migrate gateway encryption checker, UpdatePaymentStateExtension, and factory service definitions & aliases from XML to PHP.
Form / Provider
.../services/form.php, .../services/form.xml, .../services/provider.php, .../services/provider.xml
Register form type extensions and PaymentDescriptionProvider in PHP configs; remove XML originals.
Order-pay & Shop integrations
.../services/order_pay.php, .../services/order_pay.xml, .../integrations/sylius_shop.php, .../integrations/sylius_shop.xml, .../integrations/sylius_shop/order_pay/providers.php, .../integrations/sylius_shop/order_pay/providers.xml
Migrate abstract order-pay providers and Sylius shop integration provider decorations from XML to PHP; add PHP integration files and remove XML counterparts.
Payment-request subsystem
src/Sylius/Bundle/PayumBundle/Resources/config/services/payment_request/*.php, src/Sylius/Bundle/PayumBundle/Resources/config/services/payment_request/*.xml
Full migration of payment-request subsystem (action, command_handler, command_provider, context, factory, processor, resolver): new PHP service definitions, tagged locators and messenger bindings; XML files removed.
Other removed XMLs
src/Sylius/Bundle/PayumBundle/Resources/config/services/*.xml (multiple)
Remove XML service files corresponding to each newly added PHP config — overall DI format migration across the bundle.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested labels

DX, Maintenance

Suggested reviewers

  • TheMilek
  • GSadee

Poem

🐰 I hopped through configs, swapped XML for PHP,

Tagged locators found — a tidy little spree,
Loaders changed, services moved with care,
I nibbled old XML and left the PHP fair,
Hop, skip, deploy — a rabbit’s config prayer.

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title '[XML2PHP] PayumBundle' clearly and concisely summarizes the main change: converting XML configuration files to PHP equivalents in the PayumBundle.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 31, 2026

❌ Preview Environment deleted from Bunnyshell

Available commands:

  • 🚀 /bns:deploy to redeploy the environment


return static function (ContainerConfigurator $container) {
$services = $container->services();
$parameters = $container->parameters();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$parameters = $container->parameters();

Comment on lines +17 to +19
$services = $container->services();
$parameters = $container->parameters();
$container->import('sylius_shop/**/*.php');
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$services = $container->services();
$parameters = $container->parameters();
$container->import('sylius_shop/**/*.php');
$container->import('sylius_shop/**/*.php');

Comment on lines +20 to +24
$services = $container->services();
$parameters = $container->parameters();

$services->defaults()
->public();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$services = $container->services();
$parameters = $container->parameters();
$services->defaults()
->public();
$services = $container->services();
$services->defaults()->public();


return static function (ContainerConfigurator $container) {
$services = $container->services();
$parameters = $container->parameters();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$parameters = $container->parameters();


return static function (ContainerConfigurator $container) {
$services = $container->services();
$parameters = $container->parameters();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$parameters = $container->parameters();

and it other places where unused

Comment on lines +25 to +37
$parameters = $container->parameters();

$services->set('sylius_payum.factory.get_status', GetStatusFactory::class);

$services->alias(GetStatusFactoryInterface::class, 'sylius_payum.factory.get_status');

$services->set('sylius_payum.factory.resolve_next_route', ResolveNextRouteFactory::class);

$services->alias(ResolveNextRouteFactoryInterface::class, 'sylius_payum.factory.resolve_next_route');

$services->set('sylius_payum.factory.capture', CaptureFactory::class);

$services->set('sylius_payum.factory.authorize', AuthorizeFactory::class);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$parameters = $container->parameters();
$services->set('sylius_payum.factory.get_status', GetStatusFactory::class);
$services->alias(GetStatusFactoryInterface::class, 'sylius_payum.factory.get_status');
$services->set('sylius_payum.factory.resolve_next_route', ResolveNextRouteFactory::class);
$services->alias(ResolveNextRouteFactoryInterface::class, 'sylius_payum.factory.resolve_next_route');
$services->set('sylius_payum.factory.capture', CaptureFactory::class);
$services->set('sylius_payum.factory.authorize', AuthorizeFactory::class);
$services->set('sylius_payum.factory.get_status', GetStatusFactory::class);
$services->alias(GetStatusFactoryInterface::class, 'sylius_payum.factory.get_status');
$services->set('sylius_payum.factory.resolve_next_route', ResolveNextRouteFactory::class);
$services->alias(ResolveNextRouteFactoryInterface::class, 'sylius_payum.factory.resolve_next_route');
$services->set('sylius_payum.factory.capture', CaptureFactory::class);
$services->set('sylius_payum.factory.authorize', AuthorizeFactory::class);


return static function (ContainerConfigurator $container) {
$services = $container->services();
$parameters = $container->parameters();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$parameters = $container->parameters();


return static function (ContainerConfigurator $container) {
$services = $container->services();
$parameters = $container->parameters();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$parameters = $container->parameters();

Comment on lines +20 to +26
$services = $container->services();
$parameters = $container->parameters();
$container->import('services/**.php');
$container->import('services/payment_request/**/*.php');

$services->set('sylius_payum.http_client', HttpClient::class)
->args([service(ClientInterface::class)]);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$services = $container->services();
$parameters = $container->parameters();
$container->import('services/**.php');
$container->import('services/payment_request/**/*.php');
$services->set('sylius_payum.http_client', HttpClient::class)
->args([service(ClientInterface::class)]);
$container->import('services/**.php');
$container->import('services/payment_request/**/*.php');
$services = $container->services();
$services->set('sylius_payum.http_client', HttpClient::class)->args([service(ClientInterface::class)]);


return static function (ContainerConfigurator $container) {
$services = $container->services();
$parameters = $container->parameters();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$parameters = $container->parameters();

@crydotsnake crydotsnake force-pushed the xml2php/payum branch 2 times, most recently from 69d8f7a to 3835d44 Compare February 4, 2026 08:25
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In
`@src/Sylius/Bundle/PayumBundle/Resources/config/services/payment_request/command_handler.php`:
- Around line 23-24: The closure returned by the factory lacks an explicit
return type; update the anonymous function signature that currently reads
"static function (ContainerConfigurator $container)" to include an explicit ":
void" return type (i.e., "static function (ContainerConfigurator $container):
void") so the configurator closure declares its return type; this affects the
closure that defines $services via $container->services() in the payment_request
command handler.
- Around line 36-44: The child service definitions for
'sylius_payum.command_handler.payment_request.token.capture' and '.authorize'
replace all inherited constructor arguments by calling ->args([...]) causing
missing dependencies; change these to use ->arg(index,
service('sylius_payum.factory.capture')) and ->arg(index,
service('sylius_payum.factory.authorize')) respectively (use the correct index
where the factory parameter is expected in the parent definition) so the factory
service is injected in addition to the parent args required by the token
handlers that handle CapturePaymentRequest::class and
AuthorizePaymentRequest::class.

Comment on lines +23 to +24
return static function (ContainerConfigurator $container) {
$services = $container->services();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

cat -n src/Sylius/Bundle/PayumBundle/Resources/config/services/payment_request/command_handler.php

Repository: Sylius/Sylius

Length of output: 3686


Add an explicit void return type to the configurator closure.

The closure accepts a typed argument but lacks a return type declaration. Add : void to align with the type-declaration requirement for all PHP return values.

Proposed fix
-return static function (ContainerConfigurator $container) {
+return static function (ContainerConfigurator $container): void {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
return static function (ContainerConfigurator $container) {
$services = $container->services();
return static function (ContainerConfigurator $container): void {
$services = $container->services();
🤖 Prompt for AI Agents
In
`@src/Sylius/Bundle/PayumBundle/Resources/config/services/payment_request/command_handler.php`
around lines 23 - 24, The closure returned by the factory lacks an explicit
return type; update the anonymous function signature that currently reads
"static function (ContainerConfigurator $container)" to include an explicit ":
void" return type (i.e., "static function (ContainerConfigurator $container):
void") so the configurator closure declares its return type; this affects the
closure that defines $services via $container->services() in the payment_request
command handler.

Comment on lines +36 to +44
$services->set('sylius_payum.command_handler.payment_request.token.capture')
->parent('sylius_payum.command_handler.payment_request.token')
->args([service('sylius_payum.factory.capture')])
->tag('messenger.message_handler', ['bus' => 'sylius.payment_request.command_bus', 'handles' => CapturePaymentRequest::class]);

$services->set('sylius_payum.command_handler.payment_request.token.authorize')
->parent('sylius_payum.command_handler.payment_request.token')
->args([service('sylius_payum.factory.authorize')])
->tag('messenger.message_handler', ['bus' => 'sylius.payment_request.command_bus', 'handles' => AuthorizePaymentRequest::class]);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Find the handler classes mentioned in the DI config
find . -type f -name "*PaymentRequestHandler.php" | head -20

Repository: Sylius/Sylius

Length of output: 685


🏁 Script executed:

#!/bin/bash
# List the file we're reviewing
cat -n src/Sylius/Bundle/PayumBundle/Resources/config/services/payment_request/command_handler.php

Repository: Sylius/Sylius

Length of output: 3686


🏁 Script executed:

#!/bin/bash
# Extract TokenPaymentRequestHandler constructor
rg -nP "__construct\s*\(" ./src/Sylius/Bundle/PayumBundle/PaymentRequest/CommandHandler/TokenPaymentRequestHandler.php -C 10

Repository: Sylius/Sylius

Length of output: 1172


🏁 Script executed:

#!/bin/bash
# Extract ModelPaymentRequestHandler constructor
rg -nP "__construct\s*\(" ./src/Sylius/Bundle/PayumBundle/PaymentRequest/CommandHandler/ModelPaymentRequestHandler.php -C 10

Repository: Sylius/Sylius

Length of output: 1032


🏁 Script executed:

#!/bin/bash
# Check if TokenPaymentRequestHandler uses the payumRequestFactory parameter
rg -nP "payumRequestFactory|requestFactory" ./src/Sylius/Bundle/PayumBundle/PaymentRequest/CommandHandler/TokenPaymentRequestHandler.php -C 2

Repository: Sylius/Sylius

Length of output: 508


🏁 Script executed:

#!/bin/bash
# Check if ModelPaymentRequestHandler uses the factory parameter
rg -nP "factory" ./src/Sylius/Bundle/PayumBundle/PaymentRequest/CommandHandler/ModelPaymentRequestHandler.php -C 2

Repository: Sylius/Sylius

Length of output: 474


Child ->args() overrides parent arguments entirely; use indexed ->arg() to append factory services.

In Symfony DI, calling ->args([service(...)]) on a child service replaces all inherited parent arguments. The current code would pass only the factory service to constructors expecting 6 arguments (token handlers) or 4 arguments (model handlers), causing instantiation failures since the factory parameter is actively used ($this->payumRequestFactory->createNewWithToken() and $this->factory->createNewWithModel()). Use ->arg(index, service(...)) instead:

Suggested fix
    $services->set('sylius_payum.command_handler.payment_request.token.capture')
        ->parent('sylius_payum.command_handler.payment_request.token')
-       ->args([service('sylius_payum.factory.capture')])
+       ->arg(5, service('sylius_payum.factory.capture'))
        ->tag('messenger.message_handler', ['bus' => 'sylius.payment_request.command_bus', 'handles' => CapturePaymentRequest::class]);

    $services->set('sylius_payum.command_handler.payment_request.token.authorize')
        ->parent('sylius_payum.command_handler.payment_request.token')
-       ->args([service('sylius_payum.factory.authorize')])
+       ->arg(5, service('sylius_payum.factory.authorize'))
        ->tag('messenger.message_handler', ['bus' => 'sylius.payment_request.command_bus', 'handles' => AuthorizePaymentRequest::class]);

    $services->set('sylius_payum.command_handler.payment_request.model.status')
        ->parent('sylius_payum.command_handler.payment_request.model')
-       ->args([service('sylius_payum.factory.get_status')])
+       ->arg(3, service('sylius_payum.factory.get_status'))
        ->tag('messenger.message_handler', ['bus' => 'sylius.payment_request.command_bus', 'handles' => StatusPaymentRequest::class]);

    $services->set('sylius_payum.command_handler.payment_request.model.notify')
        ->parent('sylius_payum.command_handler.payment_request.model')
-       ->args([service('sylius_payum.factory.get_status')])
+       ->arg(3, service('sylius_payum.factory.get_status'))
        ->tag('messenger.message_handler', ['bus' => 'sylius.payment_request.command_bus', 'handles' => NotifyPaymentRequest::class]);
🤖 Prompt for AI Agents
In
`@src/Sylius/Bundle/PayumBundle/Resources/config/services/payment_request/command_handler.php`
around lines 36 - 44, The child service definitions for
'sylius_payum.command_handler.payment_request.token.capture' and '.authorize'
replace all inherited constructor arguments by calling ->args([...]) causing
missing dependencies; change these to use ->arg(index,
service('sylius_payum.factory.capture')) and ->arg(index,
service('sylius_payum.factory.authorize')) respectively (use the correct index
where the factory parameter is expected in the parent definition) so the factory
service is injected in addition to the parent args required by the token
handlers that handle CapturePaymentRequest::class and
AuthorizePaymentRequest::class.

@TheMilek TheMilek merged commit 177bdfe into Sylius:2.3 Feb 4, 2026
35 of 36 checks passed
This was referenced Feb 4, 2026
@coderabbitai coderabbitai bot mentioned this pull request Mar 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants