Skip to content

[XML2PHP] Channel#18496

Merged
TheMilek merged 2 commits intoSylius:2.3from
loic425:xml2php/channel
Feb 6, 2026
Merged

[XML2PHP] Channel#18496
TheMilek merged 2 commits intoSylius:2.3from
loic425:xml2php/channel

Conversation

@loic425
Copy link
Copy Markdown
Member

@loic425 loic425 commented Oct 31, 2025

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

Summary by CodeRabbit

  • Chores
    • Converted ChannelBundle service/configuration wiring from XML to PHP, migrating debug and doctrine integrations while preserving behavior.
    • Added PHP-based debug integration for a fake channel context and registered ORM repository configuration via DI parameters.
  • Other
    • Removed "Datetime" from the package symbol whitelist.

@loic425 loic425 requested review from a team as code owners October 31, 2025 15:18
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Oct 31, 2025

📝 Walkthrough

Walkthrough

Replaces XML DI configs with PHP equivalents in ChannelBundle: loader changed from XmlFileLoader to PhpFileLoader, XML service files removed and new PHP service files added, and Datetime was removed from composer-require-checker.json symbol-whitelist.

Changes

Cohort / File(s) Summary
Composer config
composer-require-checker.json
Removed the Datetime entry from the symbol-whitelist array.
Extension loader
src/Sylius/Bundle/ChannelBundle/DependencyInjection/SyliusChannelExtension.php
Switched DI loader from XmlFileLoader to PhpFileLoader and changed config filenames loaded from .xml to .php.
Main service config
src/Sylius/Bundle/ChannelBundle/Resources/config/services.php, src/Sylius/Bundle/ChannelBundle/Resources/config/services.xml
Added services.php with service definitions, decoration, aliases and parameters; removed the corresponding services.xml.
Debug integration
src/Sylius/Bundle/ChannelBundle/Resources/config/services/integrations/debug.php, src/Sylius/Bundle/ChannelBundle/Resources/config/services/integrations/debug.xml
Added debug.php registering fake-channel services (persister, code provider, context) and tags; deleted debug.xml.
Doctrine/ORM integration
src/Sylius/Bundle/ChannelBundle/Resources/config/services/integrations/doctrine/orm.php, src/Sylius/Bundle/ChannelBundle/Resources/config/services/integrations/doctrine/orm.xml
Added orm.php setting sylius.repository.channel.class; removed the previous orm.xml parameter file.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 I nibbled old XML, dug a PHP den,
Wired services gently, then hopped back again.
Aliases set, decorators in a row,
A tiny config garden where clean containers grow.
Carrots for CI, and a warm JSON glow.

🚥 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] Channel' clearly and concisely summarizes the main change: migrating Channel bundle configuration files from XML to PHP format.

✏️ 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 Oct 31, 2025

❌ Preview Environment deleted from Bunnyshell

Available commands:

  • 🚀 /bns:deploy to redeploy the environment

@loic425 loic425 added the Maintenance CI configurations, READMEs, releases, etc. label Oct 31, 2025
@crydotsnake
Copy link
Copy Markdown
Member

@loic425 I assume the base branch should now be 2.3, right?

@loic425
Copy link
Copy Markdown
Member Author

loic425 commented Feb 2, 2026

@loic425 I assume the base branch should now be 2.3, right?

I think so.

@Rafikooo Rafikooo changed the base branch from 2.2 to 2.3 February 5, 2026 14:27
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 `@composer-require-checker.json`:
- Line 5: The entry "Datetime" in the type whitelist is incorrectly capitalized;
replace the string "Datetime" with the correct PHP built-in class name
"DateTime" so composer-require-checker recognizes the type; search for the array
containing "array", "string", ... and update the "Datetime" token to "DateTime".

In
`@src/Sylius/Bundle/ChannelBundle/Resources/config/services/integrations/debug.php`:
- Line 15: The alias for
Sylius\Bundle\ChannelBundle\Context\FakeChannel\FakeChannelCodeProviderInterface
currently inherits private visibility from its target service
'sylius.context.channel.fake_channel.code_provider', preventing type-hinted
autowiring; update the alias declaration (the $services->alias(...) line) to
make the alias public by appending ->public() so constructors expecting
FakeChannelCodeProviderInterface (e.g., FakeChannelContext,
FakeChannelPersister) can be autowired while leaving the underlying service
private.
🧹 Nitpick comments (3)
src/Sylius/Bundle/ChannelBundle/Resources/config/services/integrations/doctrine/orm.php (1)

1-8: Missing declare(strict_types=1); and formatting issue.

Per coding guidelines, all PHP files should declare strict types. Also, add a space after function keyword for consistency.

Proposed fix
 <?php
 
+declare(strict_types=1);
+
 namespace Symfony\Component\DependencyInjection\Loader\Configurator;
 
-return static function(ContainerConfigurator $container) {
+return static function (ContainerConfigurator $container): void {
     $parameters = $container->parameters();
     $parameters->set('sylius.repository.channel.class', 'Sylius\Bundle\ChannelBundle\Doctrine\ORM\ChannelRepository');
 };
src/Sylius/Bundle/ChannelBundle/Resources/config/services/integrations/debug.php (1)

1-5: Missing declare(strict_types=1); and formatting issue.

Per coding guidelines, all PHP files should declare strict types. Also, add a space after function keyword and return type for consistency.

Proposed fix
 <?php
 
+declare(strict_types=1);
+
 namespace Symfony\Component\DependencyInjection\Loader\Configurator;
 
-return static function(ContainerConfigurator $container) {
+return static function (ContainerConfigurator $container): void {
     $services = $container->services();
src/Sylius/Bundle/ChannelBundle/Resources/config/services.php (1)

1-7: Missing declare(strict_types=1); and formatting issue.

Per coding guidelines, all PHP files should declare strict types. Also, add a space after function keyword and return type for consistency.

Proposed fix
 <?php
 
+declare(strict_types=1);
+
 namespace Symfony\Component\DependencyInjection\Loader\Configurator;
 
-return static function(ContainerConfigurator $container) {
+return static function (ContainerConfigurator $container): void {
     $services = $container->services();
     $parameters = $container->parameters();

"null", "true", "false",
"static", "self", "parent",
"array", "string", "int", "float", "bool", "iterable", "callable", "void", "object", "mixed", "never",
"array", "string", "int", "float", "bool", "iterable", "callable", "void", "object", "mixed", "never", "Datetime",
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

Incorrect capitalization: Datetime should be DateTime.

PHP's built-in class uses PascalCase DateTime. The incorrect capitalization may cause composer-require-checker to not properly recognize DateTime usages.

Proposed fix
-    "array", "string", "int", "float", "bool", "iterable", "callable", "void", "object", "mixed", "never", "Datetime",
+    "array", "string", "int", "float", "bool", "iterable", "callable", "void", "object", "mixed", "never", "DateTime",
📝 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
"array", "string", "int", "float", "bool", "iterable", "callable", "void", "object", "mixed", "never", "Datetime",
"array", "string", "int", "float", "bool", "iterable", "callable", "void", "object", "mixed", "never", "DateTime",
🤖 Prompt for AI Agents
In `@composer-require-checker.json` at line 5, The entry "Datetime" in the type
whitelist is incorrectly capitalized; replace the string "Datetime" with the
correct PHP built-in class name "DateTime" so composer-require-checker
recognizes the type; search for the array containing "array", "string", ... and
update the "Datetime" token to "DateTime".

$services->set('sylius.context.channel.fake_channel.code_provider', 'Sylius\Bundle\ChannelBundle\Context\FakeChannel\FakeChannelCodeProvider')
->private();

$services->alias('Sylius\Bundle\ChannelBundle\Context\FakeChannel\FakeChannelCodeProviderInterface', 'sylius.context.channel.fake_channel.code_provider');
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:

rg "FakeChannelCodeProviderInterface" --type xml -C 3

Repository: Sylius/Sylius

Length of output: 39


🏁 Script executed:

cat -n src/Sylius/Bundle/ChannelBundle/Resources/config/services/integrations/debug.php

Repository: Sylius/Sylius

Length of output: 1493


🏁 Script executed:

rg "FakeChannelCodeProviderInterface" --type php -B 2 -A 2

Repository: Sylius/Sylius

Length of output: 8530


🏁 Script executed:

# Check if there are any other usages or patterns in the codebase showing how similar aliases are configured
rg "alias\(" src/Sylius/Bundle/ChannelBundle/Resources/config/services/ -A 1 -B 1

Repository: Sylius/Sylius

Length of output: 460


Make the alias public to enable type-hinted autowiring.

The FakeChannelCodeProviderInterface alias inherits the private visibility from its target service, preventing type-hint based dependency injection. Since the interface is used in constructor type hints throughout the codebase (FakeChannelContext, FakeChannelPersister), make the alias public by adding ->public() to allow autowiring, while keeping the underlying service private.

🤖 Prompt for AI Agents
In
`@src/Sylius/Bundle/ChannelBundle/Resources/config/services/integrations/debug.php`
at line 15, The alias for
Sylius\Bundle\ChannelBundle\Context\FakeChannel\FakeChannelCodeProviderInterface
currently inherits private visibility from its target service
'sylius.context.channel.fake_channel.code_provider', preventing type-hinted
autowiring; update the alias declaration (the $services->alias(...) line) to
make the alias public by appending ->public() so constructors expecting
FakeChannelCodeProviderInterface (e.g., FakeChannelContext,
FakeChannelPersister) can be autowired while leaving the underlying service
private.

@TheMilek TheMilek merged commit 04b0d4e into Sylius:2.3 Feb 6, 2026
35 of 36 checks passed
@loic425 loic425 deleted the xml2php/channel branch February 25, 2026 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Maintenance CI configurations, READMEs, releases, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants