Skip to content

[XML2PHP] ProductBundle#18769

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

[XML2PHP] ProductBundle#18769
TheMilek merged 1 commit intoSylius:2.3from
crydotsnake:xml2php/product

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

  • New Features

    • Product form types, variant generation, resolvers, transformers and validators are registered to restore product creation/editing, variant generation, and related validations.
  • Chores

    • ProductBundle service configuration migrated from XML to PHP for consistent wiring.
    • Dependency checker whitelist updated to permit tagged-iterator resolver wiring.

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

coderabbitai bot commented Jan 31, 2026

📝 Walkthrough

Walkthrough

Swaps XML DI configs for PHP in ProductBundle: Extension now uses PhpFileLoader and loads .php service fragments (services, form, validators, integrations). Adds many service/alias/tag declarations as PHP files and deletes corresponding XML files. Adds tagged_iterator to composer-require-checker.json symbol whitelist.

Changes

Cohort / File(s) Summary
Extension
src/Sylius/Bundle/ProductBundle/DependencyInjection/SyliusProductExtension.php
Replaced XmlFileLoader with PhpFileLoader and updated resource paths to load .php config files.
Core services
src/Sylius/Bundle/ProductBundle/Resources/config/services.php, src/Sylius/Bundle/ProductBundle/Resources/config/services.xml
Added PHP service definitions (services.php) including decorated factories, generators, resolvers, aliases and tags; removed services.xml.
Form services
src/Sylius/Bundle/ProductBundle/Resources/config/services/form.php, src/Sylius/Bundle/ProductBundle/Resources/config/services/form.xml
Added form.php registering form types, transformers, event subscriber, and validation-group params; removed form.xml.
Integrations (Doctrine ORM)
src/Sylius/Bundle/ProductBundle/Resources/config/services/integrations/doctrine/orm.php, .../orm.xml
Added PHP parameters mapping repository classes (orm.php); removed the XML parameters file.
Validators
src/Sylius/Bundle/ProductBundle/Resources/config/services/validators.php, .../validators.xml
Added PHP validator service definitions and tags; removed the XML validators file.
Dependency checker
composer-require-checker.json
Added tagged_iterator to the symbol-whitelist and adjusted order between service and inline_service.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

Maintenance, DX

Suggested reviewers

  • TheMilek
  • GSadee

Poem

🐇 I hopped from XML to PHP today,
Containers sing and configs play.
Tagged_iterator found its seat,
Services wired, tidy and neat.
A little rabbit’s joyful sway.

🚥 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] ProductBundle' clearly and specifically describes the main change: converting XML service configurations to PHP format in the ProductBundle, which is the primary modification across all changed 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

Comment on lines +22 to +25
$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
$parameters = $container->parameters();
$services->defaults()
->public();
$services->defaults()->public();

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

$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();
$container->import('services/**/*.php');
$services->defaults()
->public();
$container->import('services/**/*.php');
$services = $container->services();
$services->defaults()->public();

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: 1

🤖 Fix all issues with AI agents
In `@src/Sylius/Bundle/ProductBundle/Resources/config/services.php`:
- Line 35: The closure calling $container->import('services/**/*.php') should be
updated to include an explicit return type declaration (add ": void" to the
closure signature) and the glob should be narrowed to avoid re-importing
integration files (change the pattern from "services/**/*.php" to
"services/*.php"); update the closure that contains the $container->import call
(the anonymous function in this services.php file) to have a void return type
and replace the glob pattern so it only imports top-level service files and
prevents duplicates already loaded by SyliusProductExtension.
🧹 Nitpick comments (1)
src/Sylius/Bundle/ProductBundle/Resources/config/services/validators.php (1)

20-20: Add : void return type to the config closure.

This keeps the DI config aligned with the typing rule for PHP code.

♻️ Suggested change
-return static function (ContainerConfigurator $container) {
+return static function (ContainerConfigurator $container): void {

As per coding guidelines: Add type declarations for all properties, arguments, and return values in PHP code.


return static function (ContainerConfigurator $container) {
$services = $container->services();
$container->import('services/**/*.php');
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 | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# First, let's examine the services.php file to understand context
head -n 50 src/Sylius/Bundle/ProductBundle/Resources/config/services.php

Repository: Sylius/Sylius

Length of output: 2179


🏁 Script executed:

# List the directory structure under services/
find src/Sylius/Bundle/ProductBundle/Resources/config/services -type f -name "*.php" | sort

Repository: Sylius/Sylius

Length of output: 284


🏁 Script executed:

# Find the SyliusProductExtension class to see how it loads integrations
find . -name "*ProductExtension*" -o -name "*Extension.php" | grep -i product

Repository: Sylius/Sylius

Length of output: 1527


🏁 Script executed:

# Examine SyliusProductExtension to see how it loads integrations
cat -n src/Sylius/Bundle/ProductBundle/DependencyInjection/SyliusProductExtension.php

Repository: Sylius/Sylius

Length of output: 5565


🏁 Script executed:

# Check if there's any mention of integration loading patterns
rg -n "services/integrations" src/Sylius/Bundle/ProductBundle/

Repository: Sylius/Sylius

Length of output: 221


🏁 Script executed:

# Check other bundle configurations to see if they use narrower globs
rg -A2 'import\(.*services' src/Sylius/Bundle/*/Resources/config/ | head -40

Repository: Sylius/Sylius

Length of output: 314


🏁 Script executed:

# Check if there's documentation or other patterns for services directory structure
rg -n 'services/\*\*' src/Sylius/Bundle/*/Resources/config/

Repository: Sylius/Sylius

Length of output: 603


Add return type declaration to closure and narrow glob import to avoid duplicate loading.

The closure at line 35 lacks an explicit return type (: void per PHP 8.2+ guidelines). Additionally, services/**/*.php will re-import services/integrations/%s.php that is already explicitly loaded by SyliusProductExtension at line 43 before services.php is loaded. Narrow the glob to top-level files only:

Suggested changes
-return static function (ContainerConfigurator $container) {
+return static function (ContainerConfigurator $container): void {
     $services = $container->services();
-    $container->import('services/**/*.php');
+    $container->import('services/*.php');
🤖 Prompt for AI Agents
In `@src/Sylius/Bundle/ProductBundle/Resources/config/services.php` at line 35,
The closure calling $container->import('services/**/*.php') should be updated to
include an explicit return type declaration (add ": void" to the closure
signature) and the glob should be narrowed to avoid re-importing integration
files (change the pattern from "services/**/*.php" to "services/*.php"); update
the closure that contains the $container->import call (the anonymous function in
this services.php file) to have a void return type and replace the glob pattern
so it only imports top-level service files and prevents duplicates already
loaded by SyliusProductExtension.

@crydotsnake crydotsnake force-pushed the xml2php/product branch 2 times, most recently from 7305fd0 to f3da284 Compare February 4, 2026 09:51
@TheMilek TheMilek merged commit 8f21d88 into Sylius:2.3 Feb 4, 2026
36 checks passed
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