Skip to content

[XML2PHP] PaymentBundle#18767

Merged
TheMilek merged 2 commits intoSylius:2.3from
crydotsnake:xml2php/payment
Feb 6, 2026
Merged

[XML2PHP] PaymentBundle#18767
TheMilek merged 2 commits intoSylius:2.3from
crydotsnake:xml2php/payment

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 internal service configuration to a new format for improved code organization and maintainability.

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

coderabbitai bot commented Jan 31, 2026

📝 Walkthrough

Walkthrough

Migrates XML-based Symfony service configurations to PHP-based equivalents in the PaymentBundle by replacing XmlFileLoader with PhpFileLoader in the extension class and converting all service definition files from .xml to .php format.

Changes

Cohort / File(s) Summary
Extension Configuration
src/Sylius/Bundle/PaymentBundle/DependencyInjection/SyliusPaymentExtension.php
Switches service loader from XmlFileLoader to PhpFileLoader; updates configuration paths and file extensions from .xml to .php; adds initialization of sylius.encryption.disabled_for_factories parameter to null when encryption is disabled.
Service Definitions — Main
src/Sylius/Bundle/PaymentBundle/Resources/config/services.php, src/Sylius/Bundle/PaymentBundle/Resources/config/services.xml
Replaces XML service definitions with PHP equivalents; registers parameters, services, and aliases for payment factory, resolver registry, payment methods resolver, form registry, validators, and gateway name generator.
Service Definitions — Announcer
src/Sylius/Bundle/PaymentBundle/Resources/config/services/announcer.php, src/Sylius/Bundle/PaymentBundle/Resources/config/services/announcer.xml
Migrates payment request announcer service and interface alias from XML to PHP configuration.
Service Definitions — Canceller
src/Sylius/Bundle/PaymentBundle/Resources/config/services/canceller.php, src/Sylius/Bundle/PaymentBundle/Resources/config/services/canceller.xml
Converts payment request canceller service definition with four constructor arguments from XML to PHP format.
Service Definitions — Checker
src/Sylius/Bundle/PaymentBundle/Resources/config/services/checker.php, src/Sylius/Bundle/PaymentBundle/Resources/config/services/checker.xml
Migrates two payment request checker services (duplication and finalized) with interface aliases from XML to PHP.
Service Definitions — Command Handler
src/Sylius/Bundle/PaymentBundle/Resources/config/services/command_handler.php, src/Sylius/Bundle/PaymentBundle/Resources/config/services/command_handler.xml
Converts two offline payment command handlers with messenger bus tagging from XML to PHP configuration.
Service Definitions — Command Provider
src/Sylius/Bundle/PaymentBundle/Resources/config/services/command_provider.php, src/Sylius/Bundle/PaymentBundle/Resources/config/services/command_provider.xml
Migrates payment command providers with tagged locators and gateway factory scoping from XML to PHP.
Service Definitions — Console Command
src/Sylius/Bundle/PaymentBundle/Resources/config/services/console_command.php, src/Sylius/Bundle/PaymentBundle/Resources/config/services/console_command.xml
Converts encryption key generation console command service from XML to PHP with public visibility and console.command tagging.
Service Definitions — Controllers
src/Sylius/Bundle/PaymentBundle/Resources/config/services/controllers.php, src/Sylius/Bundle/PaymentBundle/Resources/config/services/controllers.xml
Migrates two payment notify action controllers with multiple constructor arguments from XML to PHP format.
Service Definitions — Encryption
src/Sylius/Bundle/PaymentBundle/Resources/config/services/encryption/encryption.php, src/Sylius/Bundle/PaymentBundle/Resources/config/services/encryption/encryption.xml
Converts encryption-related services (checker, encrypters, listeners) with Doctrine event listener tags from XML to PHP.
Service Definitions — Form
src/Sylius/Bundle/PaymentBundle/Resources/config/services/form.php, src/Sylius/Bundle/PaymentBundle/Resources/config/services/form.xml
Migrates six form type services, validation group parameters, and form.type tagging from XML to PHP configuration.
Service Definitions — Listener
src/Sylius/Bundle/PaymentBundle/Resources/config/services/listener.php, src/Sylius/Bundle/PaymentBundle/Resources/config/services/listener.xml
Converts payment method change event listener with Doctrine postUpdate tag from XML to PHP.
Service Definitions — Normalizer
src/Sylius/Bundle/PaymentBundle/Resources/config/services/normalizer.php, src/Sylius/Bundle/PaymentBundle/Resources/config/services/normalizer.xml
Migrates Symfony request normalizer service with interface alias from XML to PHP format.
Service Definitions — Processors
src/Sylius/Bundle/PaymentBundle/Resources/config/services/processors.php, src/Sylius/Bundle/PaymentBundle/Resources/config/services/processors.xml
Converts two payment request processors (notify payload and HTTP response) with interface aliases from XML to PHP.
Service Definitions — Provider
src/Sylius/Bundle/PaymentBundle/Resources/config/services/provider.php, src/Sylius/Bundle/PaymentBundle/Resources/config/services/provider.xml
Migrates nine payment provider services with tagged locators, aliases, and gateway factory tags from XML to PHP.
Service Definitions — Validator
src/Sylius/Bundle/PaymentBundle/Resources/config/services/validator.php, src/Sylius/Bundle/PaymentBundle/Resources/config/services/validator.xml
Converts gateway factory exists validator service with constraint validator tag from XML to PHP.
Tests
src/Sylius/Bundle/PaymentBundle/tests/DependencyInjection/SyliusPaymentExtensionTest.php
Adds assertion verifying that encryption-disabled-for-factories parameter is null when encryption is disabled.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • PR #18775: Performs XML→PHP DI migration in another bundle with identical pattern of replacing XmlFileLoader with PhpFileLoader and converting service configs from .xml to .php
  • PR #18769: Executes same DI configuration format migration strategy across different bundle services
  • PR #18761: Applies identical XML→PHP service configuration refactor in a separate Sylius bundle

Suggested labels

Maintenance, DX

Suggested reviewers

  • GSadee

Poem

🐰 XML files hop away to the past,
PHP configs arrive at last,
DI loaders dance a graceful migration,
Services configured with PHP sensation,
The payment bundle's journey of transformation! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% 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 PR title '[XML2PHP] PaymentBundle' directly and clearly describes the main objective: migrating XML service configurations to PHP-based configurations for the PaymentBundle. This is the primary change across all modified files.

✏️ 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 +34 to +37
$services->set('sylius.encrypter', Encrypter::class)
->args(['%env(resolve:SYLIUS_PAYMENT_ENCRYPTION_KEY_PATH)%']);

$services->alias(EncrypterInterface::class, 'sylius.encrypter');
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->set('sylius.encrypter', Encrypter::class)
->args(['%env(resolve:SYLIUS_PAYMENT_ENCRYPTION_KEY_PATH)%']);
$services->alias(EncrypterInterface::class, 'sylius.encrypter');
$services->set('sylius.encrypter', Encrypter::class)
->args(['%env(resolve:SYLIUS_PAYMENT_ENCRYPTION_KEY_PATH)%']);
$services->alias(EncrypterInterface::class, 'sylius.encrypter');

refers to all aliases in all PR's

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.

also have you checked how this behaves when we pass null here? <argument on-invalid="null">%sylius.encryption.disabled_for_factories%</argument>

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.

I think we should add ->nullOnInvalid() there


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();


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 +21 to +25
$parameters = $container->parameters();

$services->set('sylius.normalizer.symfony_request', SymfonyRequestNormalizer::class);

$services->alias(SymfonyRequestNormalizerInterface::class, 'sylius.normalizer.symfony_request');
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.normalizer.symfony_request', SymfonyRequestNormalizer::class);
$services->alias(SymfonyRequestNormalizerInterface::class, 'sylius.normalizer.symfony_request');
$services->set('sylius.normalizer.symfony_request', SymfonyRequestNormalizer::class);
$services->alias(SymfonyRequestNormalizerInterface::class, 'sylius.normalizer.symfony_request');

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

$services->set('sylius.processor.payment_request.notify_payload', NotifyPayloadProcessor::class)
->args([service('sylius.normalizer.symfony_request')]);

$services->alias(NotifyPayloadProcessorInterface::class, 'sylius.processor.payment_request.notify_payload');

$services->set('sylius.processor.payment_request.http_response', HttpResponseProcessor::class)
->args([
service('sylius.announcer.payment_request'),
service('sylius.provider.http_response.default'),
]);

$services->alias(HttpResponseProcessorInterface::class, 'sylius.processor.payment_request.http_response');
};
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.processor.payment_request.notify_payload', NotifyPayloadProcessor::class)
->args([service('sylius.normalizer.symfony_request')]);
$services->alias(NotifyPayloadProcessorInterface::class, 'sylius.processor.payment_request.notify_payload');
$services->set('sylius.processor.payment_request.http_response', HttpResponseProcessor::class)
->args([
service('sylius.announcer.payment_request'),
service('sylius.provider.http_response.default'),
]);
$services->alias(HttpResponseProcessorInterface::class, 'sylius.processor.payment_request.http_response');
};
$services->set('sylius.processor.payment_request.notify_payload', NotifyPayloadProcessor::class)
->args([service('sylius.normalizer.symfony_request')]);
$services->alias(NotifyPayloadProcessorInterface::class, 'sylius.processor.payment_request.notify_payload');
$services->set('sylius.processor.payment_request.http_response', HttpResponseProcessor::class)
->args([
service('sylius.announcer.payment_request'),
service('sylius.provider.http_response.default'),
]);
$services->alias(HttpResponseProcessorInterface::class, 'sylius.processor.payment_request.http_response');
};


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 +31 to +33
$services = $container->services();
$parameters = $container->parameters();
$container->import('services/*.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('services/*.php');
$container->import('services/*.php');
$services = $container->services();
$parameters = $container->parameters();

@crydotsnake crydotsnake force-pushed the xml2php/payment branch 4 times, most recently from dbb6d8b to 19fd95d Compare February 4, 2026 10:24
@crydotsnake crydotsnake requested a review from TheMilek February 5, 2026 09:35
@TheMilek TheMilek merged commit c821e61 into Sylius:2.3 Feb 6, 2026
36 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Feb 6, 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