Skip to content

[XML2PHP] Core#18497

Merged
TheMilek merged 3 commits intoSylius:2.3from
loic425:xml2php/core
Feb 6, 2026
Merged

[XML2PHP] Core#18497
TheMilek merged 3 commits intoSylius:2.3from
loic425:xml2php/core

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

    • Configuration migrated from XML to PHP; symbol whitelist updated (Datetime added).
  • New Features

    • Complete catalog promotion workflow (applicators, calculators, checkers, processors, handlers, listeners).
    • Fixtures and fixture factories for sample data.
    • New subsystems: price history, telemetry, mailer, order-pay, order-processing, state resolvers, validators, rich form types, Twig extensions, and product-variant mapping.

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

coderabbitai bot commented Oct 31, 2025

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

 ______________________________________________________________________
< If it “compiles on my machine”, I will make your machine my machine. >
 ----------------------------------------------------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).

✏️ Tip: You can disable in-progress messages and the fortune message in your review settings.

📝 Walkthrough

Walkthrough

Replaces XML-based Symfony DI with PHP-based DI across Sylius CoreBundle: XmlFileLoader → PhpFileLoader in the extension; removes many .xml service files and adds equivalent .php configurators; adds Datetime to composer-require-checker whitelist. (49 words)

Changes

Cohort / File(s) Summary
Extension
src/Sylius/Bundle/CoreBundle/DependencyInjection/SyliusCoreExtension.php
Swapped XmlFileLoaderPhpFileLoader; switched config loads from .xml to .php; updated configureTelemetry() signature to accept PhpFileLoader.
Composer whitelist
composer-require-checker.json
Added Datetime to symbol-whitelist.
Root services
src/Sylius/Bundle/CoreBundle/Resources/config/services.php, src/Sylius/Bundle/CoreBundle/Resources/config/services.xml
Removed monolithic XML services.xml; added services.php consolidating parameters, many services, aliases, tags and decorations in PHP.
Catalog promotion
src/.../catalog_promotion/*.php, src/.../catalog_promotion/*.xml
Deleted XML fragments and added PHP equivalents for applicators, calculators, checkers, command_handlers, listeners, processors and their aliases/tags.
Form & validators
src/.../services/form.php, src/.../services/validators.php, src/.../*.xml
Converted form types, extensions, data transformers and validators from XML into PHP service configurators (many new PHP files; XML removals).
Listeners & workflow
src/.../services/listeners.php, src/.../listeners/workflow/*.php, src/.../*.xml
Moved kernel/doctrine/workflow listeners/subscribers from XML to PHP; split workflow listeners into per-area PHP files with preserved event/tag/priority wiring.
Order processing & order_pay
src/.../order_processing.php, src/.../order_pay/*.php, src/.../*.xml
Migrated order-processing parameters, processors and order_pay controllers/handlers/providers/processors to PHP; added parameters and public after-checkout processor where applicable.
Providers & statistics
src/.../services/providers.php, src/.../providers.xml
Rewrote providers/statistics services (delivery time, channel-based providers, orders totals/counts, sales/business providers) as PHP service files.
Fixtures & factories
src/.../services/fixtures*.php, src/.../fixtures_factories.php, src/.../*.xml
Replaced fixtures and example-factory XML files with PHP service definitions and fixture listeners; numerous sylius.fixture.* services added.
Subsystems
src/.../services/{telemetry,price_history,promotion,taxation,templating,mailer,...}.php, .../*.xml
Converted many subsystem DI configs from XML to PHP (telemetry, price_history, promotion, taxation, templating, mailer, etc.) and removed corresponding XML files.
Test services
src/.../test_services.php, src/.../test_services.xml
Added PHP test service definitions (Behat factories, alias) replacing XML test services.
Small validator change
src/Sylius/Bundle/CoreBundle/Validator/Constraints/HasEnabledEntityValidator.php
Added try/catch around registry getManager($manager) to handle InvalidArgumentException and set null object manager before existing validation check.
Tests
src/Sylius/Bundle/CoreBundle/tests/Validator/...
Adjusted tests to expect registry::getManager to throw InvalidArgumentException for missing manager case.

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

Possibly related PRs

Suggested reviewers

  • GSadee
  • mpysiak
  • Rafikooo

Poem

🐇
I hopped through configs, old XML in paw,
Swapped leaves for PHP, neat as a law,
Services reborn, tags snug in a row,
Containers hum softly — off I go!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.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 Title concisely and accurately indicates the main change: migrating Core service/config files from XML to PHP.

✏️ 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
@Rafikooo Rafikooo changed the base branch from 2.2 to 2.3 February 5, 2026 15:09
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

Note

Due to the large number of review comments, Critical, Major severity comments were prioritized as inline comments.

🤖 Fix all issues with AI agents
In
`@src/Sylius/Bundle/CoreBundle/Resources/config/services/installer_requirements.php`:
- Around line 9-17: The services definition for
'sylius.requirements.installer.sylius' is building the argument list with
repeated '' keys so only the last inline service (FilesystemRequirements) is
kept; update the args passed to
Sylius\Bundle\CoreBundle\Installer\Requirement\SyliusRequirements to use a
numeric array of the three inline services (SettingsRequirements,
ExtensionsRequirements, FilesystemRequirements) instead of repeated associative
'' => entries, preserving each inline_service(...) call and their
args(service('translator'), etc.) so all three requirements are included.

In
`@src/Sylius/Bundle/CoreBundle/Resources/config/services/integrations/hwi_oauth.php`:
- Around line 10-12: The service definition is passing an empty string as the
first argument where the shop user class parameter must be provided; update the
args array for the HWI OAuth provider service so the first element is the shop
user class parameter (e.g., use the parameter that resolves to
ShopUserInterface::class or %sylius.model.shop_user.class%) instead of '',
ensuring this value is passed into the parent UsernameOrEmailProvider
constructor for correct type validation and identification.
🟡 Minor comments (39)
src/Sylius/Bundle/CoreBundle/Resources/config/services/factories.php-1-3 (1)

1-3: ⚠️ Potential issue | 🟡 Minor

Missing declare(strict_types=1); declaration.

Per coding guidelines, all PHP files must declare strict_types=1 at the beginning.

🔧 Proposed fix
 <?php
 
+declare(strict_types=1);
+
 namespace Symfony\Component\DependencyInjection\Loader\Configurator;
composer-require-checker.json-5-5 (1)

5-5: ⚠️ Potential issue | 🟡 Minor

Fix casing: Datetime should be DateTime.

PHP's built-in class uses capital T (DateTime). While PHP class names are case-insensitive at runtime, the require-checker tool may be case-sensitive when matching symbols, and consistency with the actual class name is preferred.

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",
src/Sylius/Bundle/CoreBundle/Resources/config/services/payment.php-1-3 (1)

1-3: ⚠️ Potential issue | 🟡 Minor

Missing declare(strict_types=1); statement.

Per coding guidelines, all PHP files must declare strict types at the beginning.

🛡️ Proposed fix
 <?php
 
+declare(strict_types=1);
+
 namespace Symfony\Component\DependencyInjection\Loader\Configurator;
src/Sylius/Bundle/CoreBundle/Resources/config/services/listeners/workflow/payment.php-1-2 (1)

1-2: ⚠️ Potential issue | 🟡 Minor

Missing declare(strict_types=1) statement.

As per coding guidelines, all PHP files must declare strict_types=1 at the beginning.

Proposed fix
 <?php
 
+declare(strict_types=1);
+
 namespace Symfony\Component\DependencyInjection\Loader\Configurator;
src/Sylius/Bundle/CoreBundle/Resources/config/services/listeners.php-1-2 (1)

1-2: ⚠️ Potential issue | 🟡 Minor

Missing declare(strict_types=1) statement.

As per coding guidelines, all PHP files must declare strict_types=1 at the beginning.

Proposed fix
 <?php
 
+declare(strict_types=1);
+
 namespace Symfony\Component\DependencyInjection\Loader\Configurator;
src/Sylius/Bundle/CoreBundle/Resources/config/services/calculators.php-1-2 (1)

1-2: ⚠️ Potential issue | 🟡 Minor

Missing declare(strict_types=1) statement.

As per coding guidelines, all PHP files must declare strict_types=1 at the beginning.

Proposed fix
 <?php
 
+declare(strict_types=1);
+
 namespace Symfony\Component\DependencyInjection\Loader\Configurator;
src/Sylius/Bundle/CoreBundle/Resources/config/services/order_pay/processors.php-1-2 (1)

1-2: ⚠️ Potential issue | 🟡 Minor

Missing declare(strict_types=1) statement.

As per coding guidelines, all PHP files must declare strict_types=1 at the beginning.

Proposed fix
 <?php
 
+declare(strict_types=1);
+
 namespace Symfony\Component\DependencyInjection\Loader\Configurator;
src/Sylius/Bundle/CoreBundle/Resources/config/services/integrations/hwi_oauth.php-1-2 (1)

1-2: ⚠️ Potential issue | 🟡 Minor

Missing declare(strict_types=1) statement.

As per coding guidelines, all PHP files must declare strict_types=1 at the beginning.

Proposed fix
 <?php
 
+declare(strict_types=1);
+
 namespace Symfony\Component\DependencyInjection\Loader\Configurator;
src/Sylius/Bundle/CoreBundle/Resources/config/services/integrations/doctrine/orm.php-1-2 (1)

1-2: ⚠️ Potential issue | 🟡 Minor

Missing declare(strict_types=1) statement.

As per coding guidelines, all PHP files must declare strict_types=1 at the beginning.

Proposed fix
 <?php
 
+declare(strict_types=1);
+
 namespace Symfony\Component\DependencyInjection\Loader\Configurator;
src/Sylius/Bundle/CoreBundle/Resources/config/services/command_handler.php-1-5 (1)

1-5: ⚠️ Potential issue | 🟡 Minor

Add strict types and an explicit void return for the configurator closure.

This file lacks declare(strict_types=1); at the beginning, and the closure has no return type.

Proposed fix
 <?php
+declare(strict_types=1);
+
 namespace Symfony\Component\DependencyInjection\Loader\Configurator;

-return static function(ContainerConfigurator $container) {
+return static function(ContainerConfigurator $container): void {

As per coding guidelines: Declare strict_types=1 at the beginning of all PHP files; Add type declarations for all properties, arguments, and return values in PHP code.

src/Sylius/Bundle/CoreBundle/Resources/config/services/listeners/workflow/order_shipping.php-1-5 (1)

1-5: ⚠️ Potential issue | 🟡 Minor

Add strict types and an explicit void return for the configurator closure.

This file lacks declare(strict_types=1); at the beginning, and the closure has no return type declaration.

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

As per coding guidelines: Declare strict_types=1 at the beginning of all PHP files; Add type declarations for all properties, arguments, and return values in PHP code.

src/Sylius/Bundle/CoreBundle/Resources/config/services/listeners/workflow/shipment.php-1-5 (1)

1-5: ⚠️ Potential issue | 🟡 Minor

Add strict types and return type to the configurator closure.

This file lacks declare(strict_types=1); and the closure has no return type declaration.

Proposed fix
 <?php
+declare(strict_types=1);

 namespace Symfony\Component\DependencyInjection\Loader\Configurator;

-return static function(ContainerConfigurator $container) {
+return static function(ContainerConfigurator $container): void {

As per coding guidelines: Declare strict_types=1 at the beginning of all PHP files; Add type declarations for all properties, arguments, and return values in PHP code.

src/Sylius/Bundle/CoreBundle/Resources/config/services/listeners/workflow/order_payment.php-1-5 (1)

1-5: ⚠️ Potential issue | 🟡 Minor

Add strict types and an explicit void return for the configurator closure.

This file lacks declare(strict_types=1);, and the closure has no return type.

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

Per coding guidelines: Declare strict_types=1 at the beginning of all PHP files; Add type declarations for all properties, arguments, and return values in PHP code.

src/Sylius/Bundle/CoreBundle/Resources/config/services/product_variant_map.php-1-5 (1)

1-5: ⚠️ Potential issue | 🟡 Minor

Add strict types and an explicit void return for the configurator closure.

This file lacks declare(strict_types=1); and the closure has no return type. Other service configuration files in the codebase include both.

Proposed fix
 <?php
+declare(strict_types=1);

 namespace Symfony\Component\DependencyInjection\Loader\Configurator;

-return static function(ContainerConfigurator $container) {
+return static function(ContainerConfigurator $container): void {
src/Sylius/Bundle/CoreBundle/Resources/config/services/state_resolvers.php-1-5 (1)

1-5: ⚠️ Potential issue | 🟡 Minor

Add declare(strict_types=1); and an explicit : void return type to the configurator closure.

The file lacks declare(strict_types=1); at the top, and the closure has no return type annotation.

Proposed fix
 <?php
+declare(strict_types=1);

 namespace Symfony\Component\DependencyInjection\Loader\Configurator;

-return static function(ContainerConfigurator $container) {
+return static function(ContainerConfigurator $container): void {

Per coding guidelines: Declare strict_types=1 at the beginning of all PHP files; Add type declarations for all properties, arguments, and return values in PHP code.

src/Sylius/Bundle/CoreBundle/Resources/config/services/checkers.php-1-5 (1)

1-5: ⚠️ Potential issue | 🟡 Minor

Add strict types and an explicit void return for the configurator closure.

This file lacks declare(strict_types=1); at the beginning, and the closure has no return type declaration.

Proposed fix
 <?php
+declare(strict_types=1);

 namespace Symfony\Component\DependencyInjection\Loader\Configurator;

-return static function(ContainerConfigurator $container) {
+return static function(ContainerConfigurator $container): void {

As per coding guidelines: Declare strict_types=1 at the beginning of all PHP files; Add type declarations for all properties, arguments, and return values in PHP code.

src/Sylius/Bundle/CoreBundle/Resources/config/services/catalog_promotion/checkers.php-1-6 (1)

1-6: ⚠️ Potential issue | 🟡 Minor

Add declare(strict_types=1); and explicit : void return type to the config closure.

This file should include declare(strict_types=1); at the top and an explicit : void return type for the closure, as required by the project's PHP coding guidelines. PHP 8.2+ fully supports both features.

Proposed change
 <?php
+declare(strict_types=1);

 namespace Symfony\Component\DependencyInjection\Loader\Configurator;

-return static function(ContainerConfigurator $container) {
+return static function(ContainerConfigurator $container): void {
src/Sylius/Bundle/CoreBundle/Resources/config/services/catalog_promotion/applicators.php-1-6 (1)

1-6: ⚠️ Potential issue | 🟡 Minor

Add declare(strict_types=1); and void return type to the configuration closure.

The file is missing declare(strict_types=1); at the beginning and the closure lacks an explicit : void return type. Both violate the project's PHP coding guidelines that apply to all **/*.php files. PHP 8.2 (the minimum supported version) fully supports this syntax.

Proposed change
 <?php
+declare(strict_types=1);

 namespace Symfony\Component\DependencyInjection\Loader\Configurator;

-return static function(ContainerConfigurator $container) {
+return static function(ContainerConfigurator $container): void {
src/Sylius/Bundle/CoreBundle/Resources/config/services/console_command.php-1-6 (1)

1-6: ⚠️ Potential issue | 🟡 Minor

Add declare(strict_types=1); and explicit : void return type to the config closure.

This file should include declare(strict_types=1); after the opening PHP tag and add : void return type to the configurator closure to comply with the project's PHP coding standards. The telemetry.php config file from the same [XML2PHP] Core migration includes these declarations, establishing the correct pattern for new config files.

Proposed change
 <?php
+declare(strict_types=1);

 namespace Symfony\Component\DependencyInjection\Loader\Configurator;

-return static function(ContainerConfigurator $container) {
+return static function(ContainerConfigurator $container): void {
src/Sylius/Bundle/CoreBundle/Resources/config/services/price_history/processors.php-1-6 (1)

1-6: ⚠️ Potential issue | 🟡 Minor

Add strict_types declaration to conform with project migration efforts.

Add declare(strict_types=1); after the opening <?php tag. The project is currently migrating all config files to include strict_types declarations. The : void return type is not part of the project's established pattern for DI config closures and should not be added.

Proposed change
 <?php
+declare(strict_types=1);

 namespace Symfony\Component\DependencyInjection\Loader\Configurator;

-return static function(ContainerConfigurator $container) {
+return static function(ContainerConfigurator $container) {
src/Sylius/Bundle/CoreBundle/Resources/config/services/price_history.php-1-6 (1)

1-6: ⚠️ Potential issue | 🟡 Minor

Add strict types and a void return type to the config closure.

The file is missing declare(strict_types=1); and an explicit : void return type on the configurator closure. Both are required by the project coding guidelines and align with Symfony DI configuration best practices.

Proposed change
 <?php
+declare(strict_types=1);

 namespace Symfony\Component\DependencyInjection\Loader\Configurator;

-return static function(ContainerConfigurator $container) {
+return static function(ContainerConfigurator $container): void {
src/Sylius/Bundle/CoreBundle/Resources/config/services/price_history/logger.php-1-1 (1)

1-1: ⚠️ Potential issue | 🟡 Minor

Add declare(strict_types=1); at the file start.

Required by PHP coding guidelines for all PHP files.

🔧 Proposed fix
 <?php
+declare(strict_types=1);
 
 namespace Symfony\Component\DependencyInjection\Loader\Configurator;
src/Sylius/Bundle/CoreBundle/Resources/config/services/taxation.php-1-1 (1)

1-1: ⚠️ Potential issue | 🟡 Minor

Add declare(strict_types=1); at the file start.

Required by PHP coding guidelines for all PHP files.

🔧 Proposed fix
 <?php
+declare(strict_types=1);
 
 namespace Symfony\Component\DependencyInjection\Loader\Configurator;
src/Sylius/Bundle/CoreBundle/Resources/config/services/templating.php-1-1 (1)

1-1: ⚠️ Potential issue | 🟡 Minor

Add declare(strict_types=1); at the file start.

Required by PHP coding guidelines for all PHP files.

🔧 Proposed fix
 <?php
+declare(strict_types=1);
 
 namespace Symfony\Component\DependencyInjection\Loader\Configurator;
src/Sylius/Bundle/CoreBundle/Resources/config/services/price_history/command_dispatcher.php-1-1 (1)

1-1: ⚠️ Potential issue | 🟡 Minor

Add declare(strict_types=1); at the file start.

Required by PHP coding guidelines for all PHP files.

🔧 Proposed fix
 <?php
+declare(strict_types=1);
 
 namespace Symfony\Component\DependencyInjection\Loader\Configurator;
src/Sylius/Bundle/CoreBundle/Resources/config/services/installer_requirements.php-1-1 (1)

1-1: ⚠️ Potential issue | 🟡 Minor

Add declare(strict_types=1); at the file start.

Required by PHP coding guidelines for all PHP files.

🔧 Proposed fix
 <?php
+declare(strict_types=1);
 
 namespace Symfony\Component\DependencyInjection\Loader\Configurator;
src/Sylius/Bundle/CoreBundle/Resources/config/services/price_history/checkers.php-1-1 (1)

1-1: ⚠️ Potential issue | 🟡 Minor

Add declare(strict_types=1); at the file start.

Required by PHP coding guidelines for all PHP files.

🔧 Proposed fix
 <?php
+declare(strict_types=1);
 
 namespace Symfony\Component\DependencyInjection\Loader\Configurator;
src/Sylius/Bundle/CoreBundle/Resources/config/services/price_history/command_handler.php-1-1 (1)

1-1: ⚠️ Potential issue | 🟡 Minor

Add declare(strict_types=1); at the file start.

Required by PHP coding guidelines for all PHP files.

🔧 Proposed fix
 <?php
+declare(strict_types=1);
 
 namespace Symfony\Component\DependencyInjection\Loader\Configurator;
src/Sylius/Bundle/CoreBundle/Resources/config/services/catalog_promotion/command_handlers.php-1-37 (1)

1-37: ⚠️ Potential issue | 🟡 Minor

Add declare(strict_types=1), void return type, and use class constants for handlers.

File is missing the strict types declaration at the top, the closure lacks a void return type, and handler classes are referenced as strings instead of using ::class with imports.

Suggested fix
 <?php
+declare(strict_types=1);
 
 namespace Symfony\Component\DependencyInjection\Loader\Configurator;
 
+use Sylius\Bundle\CoreBundle\CatalogPromotion\CommandHandler\ApplyCatalogPromotionsOnVariantsHandler;
+use Sylius\Bundle\CoreBundle\CatalogPromotion\CommandHandler\DisableCatalogPromotionHandler;
+use Sylius\Bundle\CoreBundle\CatalogPromotion\CommandHandler\RemoveCatalogPromotionHandler;
+use Sylius\Bundle\CoreBundle\CatalogPromotion\CommandHandler\UpdateCatalogPromotionStateHandler;
 
-return static function(ContainerConfigurator $container) {
+return static function(ContainerConfigurator $container): void {
     $services = $container->services();
     $parameters = $container->parameters();
 
-    $services->set('sylius.command_handler.catalog_promotion.apply_variants', 'Sylius\Bundle\CoreBundle\CatalogPromotion\CommandHandler\ApplyCatalogPromotionsOnVariantsHandler')
+    $services->set('sylius.command_handler.catalog_promotion.apply_variants', ApplyCatalogPromotionsOnVariantsHandler::class)
     
-    $services->set('sylius.command_handler.catalog_promotion.disable', 'Sylius\Bundle\CoreBundle\CatalogPromotion\CommandHandler\DisableCatalogPromotionHandler')
+    $services->set('sylius.command_handler.catalog_promotion.disable', DisableCatalogPromotionHandler::class)
     
-    $services->set('sylius.command_handler.catalog_promotion.remove', 'Sylius\Bundle\CoreBundle\CatalogPromotion\CommandHandler\RemoveCatalogPromotionHandler')
+    $services->set('sylius.command_handler.catalog_promotion.remove', RemoveCatalogPromotionHandler::class)
     
-    $services->set('sylius.command_handler.catalog_promotion.update_state', 'Sylius\Bundle\CoreBundle\CatalogPromotion\CommandHandler\UpdateCatalogPromotionStateHandler')
+    $services->set('sylius.command_handler.catalog_promotion.update_state', UpdateCatalogPromotionStateHandler::class)
src/Sylius/Bundle/CoreBundle/Resources/config/services/form.php-1-40 (1)

1-40: ⚠️ Potential issue | 🟡 Minor

Add strict types declaration, return type, and use class constants instead of string class names.

The file is missing declare(strict_types=1); at the beginning. The configurator closure lacks a return type declaration and should be : void. Service class names should use ::class with use imports instead of string literals.

Suggested fix (pattern to apply across this file)
 <?php
+declare(strict_types=1);

 namespace Symfony\Component\DependencyInjection\Loader\Configurator;

+use Sylius\Bundle\CoreBundle\Form\Extension\AddressTypeExtension;

-return static function(ContainerConfigurator $container) {
+return static function(ContainerConfigurator $container): void {
@@
-    $services->set('sylius.form.extension.type.address', 'Sylius\Bundle\CoreBundle\Form\Extension\AddressTypeExtension')
+    $services->set('sylius.form.extension.type.address', AddressTypeExtension::class)

Per the coding guidelines: "Declare strict_types=1 at the beginning of all PHP files", "Add type declarations for all properties, arguments, and return values in PHP code", and "Use use statements for all non-global classes in PHP".

src/Sylius/Bundle/CoreBundle/Resources/config/services.php-1-21 (1)

1-21: ⚠️ Potential issue | 🟡 Minor

Add declare(strict_types=1), a void return type, and use imports for service classes.

This file is missing declare(strict_types=1); at the top and the configurator closure lacks a void return type. Additionally, service classes should be referenced using ::class with use imports rather than string literals.

🛠️ Suggested fix (pattern to apply across this file)
 <?php
+declare(strict_types=1);

 namespace Symfony\Component\DependencyInjection\Loader\Configurator;

+use Sylius\Component\Core\Distributor\IntegerDistributor;

-return static function(ContainerConfigurator $container) {
+return static function(ContainerConfigurator $container): void {
     $services = $container->services();
     $parameters = $container->parameters();
     $container->import('services/*.php');
@@
-    $services->set('sylius.distributor.integer', 'Sylius\Component\Core\Distributor\IntegerDistributor');
+    $services->set('sylius.distributor.integer', IntegerDistributor::class);

Per coding guidelines: "Declare strict_types=1 at the beginning of all PHP files", "Add type declarations for all properties, arguments, and return values in PHP code", and "Use use statements for all non-global classes in PHP".

src/Sylius/Bundle/CoreBundle/Resources/config/services/catalog_promotion.php-1-44 (1)

1-44: ⚠️ Potential issue | 🟡 Minor

Add declare(strict_types=1);, void return type, and convert class references to ::class with use imports.

This configurator is missing declare(strict_types=1); and a void return type on the closure. It also uses string class names instead of ::class references. Convert all class references to use ::class with corresponding use imports at the top of the file.

Suggested fix
 <?php
+declare(strict_types=1);

 namespace Symfony\Component\DependencyInjection\Loader\Configurator;

+use Sylius\Bundle\CoreBundle\CatalogPromotion\Announcer\CatalogPromotionAnnouncer;
+use Sylius\Bundle\CoreBundle\CatalogPromotion\Announcer\CatalogPromotionAnnouncerInterface;
+use Sylius\Bundle\CoreBundle\CatalogPromotion\Announcer\CatalogPromotionRemovalAnnouncer;
+use Sylius\Bundle\CoreBundle\CatalogPromotion\Announcer\CatalogPromotionRemovalAnnouncerInterface;
+use Sylius\Bundle\CoreBundle\CatalogPromotion\CommandDispatcher\ApplyCatalogPromotionsOnVariantsCommandDispatcherInterface;
+use Sylius\Bundle\CoreBundle\CatalogPromotion\CommandDispatcher\BatchedApplyCatalogPromotionsOnVariantsCommandDispatcher;
+use Sylius\Bundle\CoreBundle\CatalogPromotion\DiscountApplicationCriteria\ExclusiveCriteria;
+use Sylius\Bundle\CoreBundle\CatalogPromotion\DiscountApplicationCriteria\MinimumPriceCriteria;

-return static function(ContainerConfigurator $container) {
+return static function(ContainerConfigurator $container): void {
     $services = $container->services();
     $parameters = $container->parameters();
     $container->import('catalog_promotion/applicators.php');
     $container->import('catalog_promotion/calculators.php');
     $container->import('catalog_promotion/checkers.php');
     $container->import('catalog_promotion/command_handlers.php');
     $container->import('catalog_promotion/listeners.php');
     $container->import('catalog_promotion/processors.php');
     

-    $services->set('sylius.discount_application_criteria.catalog_promotion.exclusive', 'Sylius\Bundle\CoreBundle\CatalogPromotion\DiscountApplicationCriteria\ExclusiveCriteria')
+    $services->set('sylius.discount_application_criteria.catalog_promotion.exclusive', ExclusiveCriteria::class)
         ->tag('sylius.catalog_promotion.applicator_criteria');

-    $services->set('sylius.discount_application_criteria.catalog_promotion.minimum_price', 'Sylius\Bundle\CoreBundle\CatalogPromotion\DiscountApplicationCriteria\MinimumPriceCriteria')
+    $services->set('sylius.discount_application_criteria.catalog_promotion.minimum_price', MinimumPriceCriteria::class)
         ->tag('sylius.catalog_promotion.applicator_criteria');

-    $services->set('sylius.announcer.catalog_promotion', 'Sylius\Bundle\CoreBundle\CatalogPromotion\Announcer\CatalogPromotionAnnouncer')
+    $services->set('sylius.announcer.catalog_promotion', CatalogPromotionAnnouncer::class)
         ->public()
         ->args([
             service('sylius.event_bus'),
             service('sylius.calculator.delay_stamp'),
             service('clock'),
         ]);

-    $services->alias('Sylius\Bundle\CoreBundle\CatalogPromotion\Announcer\CatalogPromotionAnnouncerInterface', 'sylius.announcer.catalog_promotion');
+    $services->alias(CatalogPromotionAnnouncerInterface::class, 'sylius.announcer.catalog_promotion');

-    $services->set('sylius.announcer.catalog_promotion.removal', 'Sylius\Bundle\CoreBundle\CatalogPromotion\Announcer\CatalogPromotionRemovalAnnouncer')
+    $services->set('sylius.announcer.catalog_promotion.removal', CatalogPromotionRemovalAnnouncer::class)
         ->public()
         ->args([service('sylius.command_bus')]);

-    $services->alias('Sylius\Bundle\CoreBundle\CatalogPromotion\Announcer\CatalogPromotionRemovalAnnouncerInterface', 'sylius.announcer.catalog_promotion.removal');
+    $services->alias(CatalogPromotionRemovalAnnouncerInterface::class, 'sylius.announcer.catalog_promotion.removal');

-    $services->set('sylius.command_dispatcher.catalog_promotion.batched_apply_on_variants', 'Sylius\Bundle\CoreBundle\CatalogPromotion\CommandDispatcher\BatchedApplyCatalogPromotionsOnVariantsCommandDispatcher')
+    $services->set('sylius.command_dispatcher.catalog_promotion.batched_apply_on_variants', BatchedApplyCatalogPromotionsOnVariantsCommandDispatcher::class)
         ->args([
             service('sylius.command_bus'),
             '%sylius_core.catalog_promotions.batch_size%',
         ]);

-    $services->alias('Sylius\Bundle\CoreBundle\CatalogPromotion\CommandDispatcher\ApplyCatalogPromotionsOnVariantsCommandDispatcherInterface', 'sylius.command_dispatcher.catalog_promotion.batched_apply_on_variants');
+    $services->alias(ApplyCatalogPromotionsOnVariantsCommandDispatcherInterface::class, 'sylius.command_dispatcher.catalog_promotion.batched_apply_on_variants');
 };
src/Sylius/Bundle/CoreBundle/Resources/config/services/catalog_promotion/processors.php-1-45 (1)

1-45: ⚠️ Potential issue | 🟡 Minor

Add declare(strict_types=1), void return type, and convert processor classes to ::class with imports.

This configurator is missing declare(strict_types=1); at the top of the file, lacks a void return type on the configurator closure, and uses string class names instead of ::class constants. Add the strict types declaration, the return type, and import all processor classes and interfaces with ::class references.

🛠️ Suggested fix
 <?php
+declare(strict_types=1);

 namespace Symfony\Component\DependencyInjection\Loader\Configurator;

+use Sylius\Bundle\CoreBundle\CatalogPromotion\Processor\AllProductVariantsCatalogPromotionsProcessor;
+use Sylius\Bundle\CoreBundle\CatalogPromotion\Processor\AllProductVariantsCatalogPromotionsProcessorInterface;
+use Sylius\Bundle\CoreBundle\CatalogPromotion\Processor\CatalogPromotionClearer;
+use Sylius\Bundle\CoreBundle\CatalogPromotion\Processor\CatalogPromotionClearerInterface;
+use Sylius\Bundle\CoreBundle\CatalogPromotion\Processor\CatalogPromotionRemovalProcessor;
+use Sylius\Bundle\CoreBundle\CatalogPromotion\Processor\CatalogPromotionRemovalProcessorInterface;
+use Sylius\Bundle\CoreBundle\CatalogPromotion\Processor\CatalogPromotionStateProcessor;
+use Sylius\Bundle\CoreBundle\CatalogPromotion\Processor\CatalogPromotionStateProcessorInterface;
+use Sylius\Bundle\CoreBundle\CatalogPromotion\Processor\ProductCatalogPromotionsProcessor;
+use Sylius\Bundle\CoreBundle\CatalogPromotion\Processor\ProductCatalogPromotionsProcessorInterface;
+use Sylius\Bundle\CoreBundle\CatalogPromotion\Processor\ProductVariantCatalogPromotionsProcessor;
+use Sylius\Bundle\CoreBundle\CatalogPromotion\Processor\ProductVariantCatalogPromotionsProcessorInterface;

-return static function(ContainerConfigurator $container) {
+return static function(ContainerConfigurator $container): void {
@@
-    $services->set('sylius.processor.catalog_promotion.all_product_variant', 'Sylius\Bundle\CoreBundle\CatalogPromotion\Processor\AllProductVariantsCatalogPromotionsProcessor')
+    $services->set('sylius.processor.catalog_promotion.all_product_variant', AllProductVariantsCatalogPromotionsProcessor::class)
@@
-    $services->alias('Sylius\Bundle\CoreBundle\CatalogPromotion\Processor\AllProductVariantsCatalogPromotionsProcessorInterface', 'sylius.processor.catalog_promotion.all_product_variant');
+    $services->alias(AllProductVariantsCatalogPromotionsProcessorInterface::class, 'sylius.processor.catalog_promotion.all_product_variant');
@@
-    $services->set('sylius.processor.catalog_promotion.clearer', 'Sylius\Bundle\CoreBundle\CatalogPromotion\Processor\CatalogPromotionClearer');
+    $services->set('sylius.processor.catalog_promotion.clearer', CatalogPromotionClearer::class);
@@
-    $services->alias('Sylius\Bundle\CoreBundle\CatalogPromotion\Processor\CatalogPromotionClearerInterface', 'sylius.processor.catalog_promotion.clearer');
+    $services->alias(CatalogPromotionClearerInterface::class, 'sylius.processor.catalog_promotion.clearer');
@@
-    $services->set('sylius.processor.catalog_promotion.state', 'Sylius\Bundle\CoreBundle\CatalogPromotion\Processor\CatalogPromotionStateProcessor')
+    $services->set('sylius.processor.catalog_promotion.state', CatalogPromotionStateProcessor::class)
@@
-    $services->alias('Sylius\Bundle\CoreBundle\CatalogPromotion\Processor\CatalogPromotionStateProcessorInterface', 'sylius.processor.catalog_promotion.state');
+    $services->alias(CatalogPromotionStateProcessorInterface::class, 'sylius.processor.catalog_promotion.state');
@@
-    $services->set('sylius.processor.catalog_promotion.product', 'Sylius\Bundle\CoreBundle\CatalogPromotion\Processor\ProductCatalogPromotionsProcessor')
+    $services->set('sylius.processor.catalog_promotion.product', ProductCatalogPromotionsProcessor::class)
@@
-    $services->alias('Sylius\Bundle\CoreBundle\CatalogPromotion\Processor\ProductCatalogPromotionsProcessorInterface', 'sylius.processor.catalog_promotion.product');
+    $services->alias(ProductCatalogPromotionsProcessorInterface::class, 'sylius.processor.catalog_promotion.product');
@@
-    $services->set('sylius.processor.catalog_promotion.product_variant', 'Sylius\Bundle\CoreBundle\CatalogPromotion\Processor\ProductVariantCatalogPromotionsProcessor')
+    $services->set('sylius.processor.catalog_promotion.product_variant', ProductVariantCatalogPromotionsProcessor::class)
@@
-    $services->alias('Sylius\Bundle\CoreBundle\CatalogPromotion\Processor\ProductVariantCatalogPromotionsProcessorInterface', 'sylius.processor.catalog_promotion.product_variant');
+    $services->alias(ProductVariantCatalogPromotionsProcessorInterface::class, 'sylius.processor.catalog_promotion.product_variant');
@@
-    $services->set('sylius.processor.catalog_promotion.removal', 'Sylius\Bundle\CoreBundle\CatalogPromotion\Processor\CatalogPromotionRemovalProcessor')
+    $services->set('sylius.processor.catalog_promotion.removal', CatalogPromotionRemovalProcessor::class)
@@
-    $services->alias('Sylius\Bundle\CoreBundle\CatalogPromotion\Processor\CatalogPromotionRemovalProcessorInterface', 'sylius.processor.catalog_promotion.removal');
+    $services->alias(CatalogPromotionRemovalProcessorInterface::class, 'sylius.processor.catalog_promotion.removal');
src/Sylius/Bundle/CoreBundle/Resources/config/services/context.php-1-16 (1)

1-16: ⚠️ Potential issue | 🟡 Minor

Add strict types, return type, and class constants to service configurator.

This file violates three coding guidelines:

  1. Missing declare(strict_types=1); at the beginning
  2. Configurator closure lacks : void return type (line 5)
  3. Service class names are strings instead of ::class with use imports (lines 9, 16, 27, 35, 43, 48, 55, 62, 69, 76)

Apply this pattern throughout the file:

Suggested pattern
 <?php
+
+declare(strict_types=1);
 
 namespace Symfony\Component\DependencyInjection\Loader\Configurator;
 
+use Sylius\Component\Channel\Context\CachedPerRequestChannelContext;
+use Sylius\Component\Core\Cart\Context\ShopBasedCartContext;
+use Sylius\Component\Core\Context\ShopperContext;
+// ... import all other service classes
+
-return static function(ContainerConfigurator $container) {
+return static function(ContainerConfigurator $container): void {
     $services = $container->services();
 
-    $services->set('sylius.context.channel.cached', 'Sylius\Component\Channel\Context\CachedPerRequestChannelContext')
+    $services->set('sylius.context.channel.cached', CachedPerRequestChannelContext::class)
src/Sylius/Bundle/CoreBundle/Resources/config/services/validators.php-1-6 (1)

1-6: ⚠️ Potential issue | 🟡 Minor

Add declare(strict_types=1) and a : void return type to the configurator closure.

The coding guidelines require strict types and explicit return types on all PHP files. The telemetry.php service configurator in the same directory demonstrates the correct pattern.

Proposed update
<?php

+declare(strict_types=1);
+
namespace Symfony\Component\DependencyInjection\Loader\Configurator;

-return static function(ContainerConfigurator $container) {
+return static function(ContainerConfigurator $container): void {
src/Sylius/Bundle/CoreBundle/Resources/config/services/fixtures.php-1-6 (1)

1-6: ⚠️ Potential issue | 🟡 Minor

Add strict_types and a : void return type to the configurator closure.

The file lacks both declare(strict_types=1) and an explicit return type. The sibling file src/Sylius/Bundle/CoreBundle/Resources/config/services/telemetry/telemetry.php (from the same modernization batch) includes both, and the project is actively adding these declarations per the coding guidelines and recent commits.

🛠️ Proposed update
<?php
+declare(strict_types=1);

namespace Symfony\Component\DependencyInjection\Loader\Configurator;

-return static function(ContainerConfigurator $container) {
+return static function(ContainerConfigurator $container): void {
src/Sylius/Bundle/CoreBundle/Resources/config/services/installer.php-1-6 (1)

1-6: ⚠️ Potential issue | 🟡 Minor

Add declare(strict_types=1); and the Sylius license header to this file.

The file is missing the standard Sylius copyright header and declare(strict_types=1); declaration. These are required by project guidelines for all PHP files in the codebase.

🛠️ Proposed update
<?php
+
+/*
+ * This file is part of the Sylius package.
+ *
+ * (c) Sylius Sp. z o.o.
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+declare(strict_types=1);

namespace Symfony\Component\DependencyInjection\Loader\Configurator;
src/Sylius/Bundle/CoreBundle/Resources/config/services/catalog_promotion/listeners.php-1-6 (1)

1-6: ⚠️ Potential issue | 🟡 Minor

Add declare(strict_types=1) and : void return type to the configurator closure.

The coding guidelines require strict types and explicit return types for all PHP files. The closure should declare void as its return type.

🛠️ Proposed update
<?php
+declare(strict_types=1);

namespace Symfony\Component\DependencyInjection\Loader\Configurator;

-return static function(ContainerConfigurator $container) {
+return static function(ContainerConfigurator $container): void {
src/Sylius/Bundle/CoreBundle/Resources/config/test_services.php-1-3 (1)

1-3: ⚠️ Potential issue | 🟡 Minor

Missing declare(strict_types=1); declaration.

As per coding guidelines, all PHP files must declare strict_types=1 at the beginning.

Proposed fix
 <?php
 
+declare(strict_types=1);
+
 namespace Symfony\Component\DependencyInjection\Loader\Configurator;
🧹 Nitpick comments (25)
src/Sylius/Bundle/CoreBundle/Resources/config/services/factories.php (1)

7-7: Remove unused $parameters variable.

The $parameters variable is defined but never used in this file.

♻️ Proposed fix
 return static function(ContainerConfigurator $container) {
     $services = $container->services();
-    $parameters = $container->parameters();
 
     $services->set('sylius.custom_factory.order', 'Sylius\Bundle\CoreBundle\Factory\OrderFactory')
src/Sylius/Bundle/CoreBundle/Resources/config/services/payment.php (1)

5-8: Remove unused $parameters variable.

The $parameters variable is declared but never used in this file.

♻️ Proposed fix
-return static function(ContainerConfigurator $container) {
+return static function (ContainerConfigurator $container): void {
     $services = $container->services();
-    $parameters = $container->parameters();
src/Sylius/Bundle/CoreBundle/Resources/config/services/calculators.php (1)

7-7: Unused variable $parameters.

The $parameters variable is declared but never used in this file. Remove it to keep the code clean.

Proposed fix
 return static function(ContainerConfigurator $container) {
     $services = $container->services();
-    $parameters = $container->parameters();
 
     $services->set('sylius.calculator.delay_stamp', 'Sylius\Bundle\CoreBundle\Calculator\DelayStampCalculator');
src/Sylius/Bundle/CoreBundle/Resources/config/services/order_pay/processors.php (1)

7-7: Unused variable $parameters.

The $parameters variable is declared but never used. Remove it to keep the code clean.

Proposed fix
 return static function(ContainerConfigurator $container) {
     $services = $container->services();
-    $parameters = $container->parameters();
 
     $services->set('sylius.processor.order_pay.route_parameters', 'Sylius\Bundle\CoreBundle\OrderPay\Processor\RouteParametersProcessor')
src/Sylius/Bundle/CoreBundle/Resources/config/services/listeners/workflow/payment.php (1)

7-7: Unused variable $parameters.

The $parameters variable is declared but never used. Remove it to keep the code clean.

Proposed fix
 return static function(ContainerConfigurator $container) {
     $services = $container->services();
-    $parameters = $container->parameters();
 
     $services->set('sylius.listener.workflow.payment.process_order', 'Sylius\Bundle\CoreBundle\EventListener\Workflow\Payment\ProcessOrderListener')
src/Sylius/Bundle/CoreBundle/Resources/config/services/listeners.php (1)

7-10: Unused variable and extra blank line.

The $parameters variable is declared but never used, and there's an extra blank line after the import statement.

Proposed fix
 return static function(ContainerConfigurator $container) {
     $services = $container->services();
-    $parameters = $container->parameters();
     $container->import('listeners/workflow/*.php');
-    
 
     $services->defaults()
src/Sylius/Bundle/CoreBundle/Resources/config/services/shipping.php (2)

1-3: Missing declare(strict_types=1) declaration.

Per coding guidelines, all PHP files should declare strict types at the beginning.

Proposed fix
 <?php
 
+declare(strict_types=1);
+
 namespace Symfony\Component\DependencyInjection\Loader\Configurator;

5-7: Minor cleanup: unused $parameters variable and formatting.

The $parameters variable is declared but never used in this file. Also, there should be a space between function and ( per PSR-12 standards.

Proposed fix
-return static function(ContainerConfigurator $container) {
+return static function (ContainerConfigurator $container): void {
     $services = $container->services();
-    $parameters = $container->parameters();
src/Sylius/Bundle/CoreBundle/Resources/config/services/order_pay/handlers.php (1)

1-7: Missing declare(strict_types=1) and minor cleanup opportunities.

Same issues as other DI config files: missing strict types declaration, unused $parameters variable, and missing space after function.

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();
src/Sylius/Bundle/CoreBundle/Resources/config/services/mailer.php (1)

1-7: Missing declare(strict_types=1) and minor cleanup opportunities.

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();
src/Sylius/Bundle/CoreBundle/Resources/config/services/command_dispatcher.php (1)

1-7: Missing declare(strict_types=1) and minor cleanup opportunities.

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();
src/Sylius/Bundle/CoreBundle/Resources/config/services/order_pay/providers.php (1)

1-7: Missing declare(strict_types=1) and minor cleanup opportunities.

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();
src/Sylius/Bundle/CoreBundle/Resources/config/services/order_pay/controllers.php (1)

1-7: Missing declare(strict_types=1) and minor cleanup opportunities.

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();
src/Sylius/Bundle/CoreBundle/Resources/config/services/order_pay.php (1)

1-10: Missing declare(strict_types=1), unused variables, and trailing whitespace.

This file only imports sub-configurations, so the $services and $parameters variables are unnecessary. There's also trailing whitespace on line 9.

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

1-6: Add strict_types and an explicit void return type to the configurator closure.

These are required by the PHP coding standards used in this repo.

Suggested change
<?php
+declare(strict_types=1);

namespace Symfony\Component\DependencyInjection\Loader\Configurator;

-return static function(ContainerConfigurator $container) {
+return static function(ContainerConfigurator $container): void {

As per coding guidelines: Declare strict_types=1 at the beginning of all PHP files; Add type declarations for all properties, arguments, and return values in PHP code.

src/Sylius/Bundle/CoreBundle/Resources/config/services/order_processing.php (1)

1-6: Add strict_types and an explicit void return type to the configurator closure.

Suggested change
<?php
+declare(strict_types=1);

namespace Symfony\Component\DependencyInjection\Loader\Configurator;

-return static function(ContainerConfigurator $container) {
+return static function(ContainerConfigurator $container): void {

As per coding guidelines: Declare strict_types=1 at the beginning of all PHP files; Add type declarations for all properties, arguments, and return values in PHP code.

src/Sylius/Bundle/CoreBundle/Resources/config/services/listeners/workflow/order.php (1)

1-6: Add strict_types and an explicit void return type to the configurator closure.

Suggested change
<?php
+declare(strict_types=1);

namespace Symfony\Component\DependencyInjection\Loader\Configurator;

-return static function(ContainerConfigurator $container) {
+return static function(ContainerConfigurator $container): void {

As per coding guidelines: Declare strict_types=1 at the beginning of all PHP files; Add type declarations for all properties, arguments, and return values in PHP code.

src/Sylius/Bundle/CoreBundle/Resources/config/services/listeners/workflow/order_checkout.php (1)

1-6: Add strict_types and an explicit void return type to the configurator closure.

Suggested change
<?php
+declare(strict_types=1);

namespace Symfony\Component\DependencyInjection\Loader\Configurator;

-return static function(ContainerConfigurator $container) {
+return static function(ContainerConfigurator $container): void {

As per coding guidelines: Declare strict_types=1 at the beginning of all PHP files; Add type declarations for all properties, arguments, and return values in PHP code.

src/Sylius/Bundle/CoreBundle/Resources/config/services/providers.php (1)

1-6: Add strict_types and an explicit void return type to the configurator closure.

Suggested change
<?php
+declare(strict_types=1);

namespace Symfony\Component\DependencyInjection\Loader\Configurator;

-return static function(ContainerConfigurator $container) {
+return static function(ContainerConfigurator $container): void {

As per coding guidelines: Declare strict_types=1 at the beginning of all PHP files; Add type declarations for all properties, arguments, and return values in PHP code.

src/Sylius/Bundle/CoreBundle/Resources/config/services/promotion.php (2)

1-6: Add strict_types and an explicit void return type to the configurator closure.

Suggested change
<?php
+declare(strict_types=1);

namespace Symfony\Component\DependencyInjection\Loader\Configurator;

-return static function(ContainerConfigurator $container) {
+return static function(ContainerConfigurator $container): void {

As per coding guidelines: Declare strict_types=1 at the beginning of all PHP files; Add type declarations for all properties, arguments, and return values in PHP code.


26-93: Alphabetize tag metadata array keys (form_type, label, type) for consistency.

Several tag metadata arrays use non-alphabetical key order (e.g., type, label, form_type). Please reorder these keys consistently across the file.

Example adjustment
-        ->tag('sylius.promotion_rule_checker', ['type' => 'customer_group', 'label' => 'sylius.form.promotion_rule.customer_group', 'form_type' => 'Sylius\Bundle\CoreBundle\Form\Type\Promotion\Rule\CustomerGroupConfigurationType']);
+        ->tag('sylius.promotion_rule_checker', ['form_type' => 'Sylius\Bundle\CoreBundle\Form\Type\Promotion\Rule\CustomerGroupConfigurationType', 'label' => 'sylius.form.promotion_rule.customer_group', 'type' => 'customer_group']);

As per coding guidelines: Order PHP array keys alphabetically where applicable.

src/Sylius/Bundle/CoreBundle/Resources/config/services/catalog_promotion/calculators.php (1)

1-6: Add strict_types and an explicit void return type to the configurator closure.

Suggested change
<?php
+declare(strict_types=1);

namespace Symfony\Component\DependencyInjection\Loader\Configurator;

-return static function(ContainerConfigurator $container) {
+return static function(ContainerConfigurator $container): void {

As per coding guidelines: Declare strict_types=1 at the beginning of all PHP files; Add type declarations for all properties, arguments, and return values in PHP code.

src/Sylius/Bundle/CoreBundle/Resources/config/services/taxation.php (1)

49-56: Order tag attribute keys alphabetically.

Guidelines require alphabetical ordering of array keys; use label before type.

♻️ Proposed fix
-        ->tag('sylius.taxation.calculation_strategy', ['type' => 'order_items_based', 'label' => 'Order items based']);
+        ->tag('sylius.taxation.calculation_strategy', ['label' => 'Order items based', 'type' => 'order_items_based']);
@@
-        ->tag('sylius.taxation.calculation_strategy', ['type' => 'order_item_units_based', 'label' => 'Order item units based']);
+        ->tag('sylius.taxation.calculation_strategy', ['label' => 'Order item units based', 'type' => 'order_item_units_based']);
src/Sylius/Bundle/CoreBundle/Resources/config/services/price_history/listeners.php (1)

28-30: Order doctrine event listener tag keys alphabetically.

Keep tag option keys in alphabetical order for consistency.

♻️ Proposed adjustment
-        ->tag('doctrine.event_listener', ['event' => 'postPersist', 'priority' => 500, 'connection' => 'default']);
+        ->tag('doctrine.event_listener', ['connection' => 'default', 'event' => 'postPersist', 'priority' => 500]);

Please confirm the team’s style expectations for tag option ordering. As per coding guidelines: Order PHP array keys alphabetically where applicable.

src/Sylius/Bundle/CoreBundle/Resources/config/test_services.php (1)

7-7: Unused variable $parameters.

This variable is assigned but never used in the file. Consider removing it to avoid dead code.

Proposed fix
 return static function(ContainerConfigurator $container) {
     $services = $container->services();
-    $parameters = $container->parameters();
 
     $services->defaults()

@TheMilek TheMilek force-pushed the xml2php/core branch 3 times, most recently from 713d40e to 39310bd Compare February 6, 2026 12:05
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/CoreBundle/Resources/config/services.php`:
- Line 416: Change the incorrect interface name
OrdersTotalsProvidersRegistryInterface to the correct
OrdersTotalsProviderRegistryInterface in this file: update the import (currently
referencing OrdersTotalsProvidersRegistryInterface) and update the service alias
call $services->alias(...) to use OrdersTotalsProviderRegistryInterface; the
concrete class OrdersTotalsProvidersRegistry already implements
OrdersTotalsProviderRegistryInterface so ensure the alias and import match that
interface name exactly.

In
`@src/Sylius/Bundle/CoreBundle/Resources/config/services/integrations/hwi_oauth.php`:
- Around line 21-33: The service definition for 'sylius.oauth.user_provider'
(UserProvider::class) is missing public visibility; update the service
registration where $services->set('sylius.oauth.user_provider',
UserProvider::class) is called to make the service public by adding ->public()
(e.g. place ->public() before ->lazy()), so the provider remains accessible to
HWIOAuthBundle and other consumers.
🧹 Nitpick comments (15)
src/Sylius/Bundle/CoreBundle/Resources/config/services/factories.php (1)

19-21: Remove unused $parameters variable.

$parameters is assigned on line 21 but never referenced in this file. This is likely a leftover from a copy-paste template.

♻️ Proposed fix
 return static function (ContainerConfigurator $container) {
     $services = $container->services();
-    $parameters = $container->parameters();

     $services->set('sylius.custom_factory.order', OrderFactory::class)
src/Sylius/Bundle/CoreBundle/Resources/config/services/product_variant_map.php (1)

26-26: Unused $parameters variable.

$parameters is assigned but never referenced. Remove it to keep the file clean.

🧹 Proposed fix
 $services = $container->services();
-    $parameters = $container->parameters();
src/Sylius/Bundle/CoreBundle/Resources/config/services/validators.php (1)

46-48: Unused $parameters variable.

$parameters is assigned on line 48 but never referenced anywhere in this file. Remove it to keep the config clean.

🧹 Remove unused variable
 return static function (ContainerConfigurator $container) {
     $services = $container->services();
-    $parameters = $container->parameters();
 
     $services->set('sylius.validator.has_enabled_entity', HasEnabledEntityValidator::class)
src/Sylius/Bundle/CoreBundle/Resources/config/services/mailer.php (1)

32-32: Unused $parameters variable.

$parameters is assigned but never referenced in this file.

Suggested fix
 return static function (ContainerConfigurator $container) {
     $services = $container->services();
-    $parameters = $container->parameters();
src/Sylius/Bundle/CoreBundle/Resources/config/services/listeners/workflow/order_shipping.php (1)

20-20: Remove unused $parameters variable.

$parameters is assigned but never used in this file. This is part of a wider pattern across 43+ PHP DI config files in this PR where the variable is declared but unused. Consider removing it.

♻️ Suggested fix
     $services = $container->services();
-    $parameters = $container->parameters();
src/Sylius/Bundle/CoreBundle/Resources/config/services/installer_requirements.php (1)

23-23: Remove unused $parameters variable.

$parameters is assigned but never referenced in this file.

♻️ Suggested fix
     $services = $container->services();
-    $parameters = $container->parameters();
src/Sylius/Bundle/CoreBundle/Resources/config/test_services.php (1)

21-21: Unused $parameters variable.

$parameters is assigned but never referenced in this file. Remove the dead assignment.

Proposed fix
 return static function (ContainerConfigurator $container) {
     $services = $container->services();
-    $parameters = $container->parameters();

     $services->defaults()
src/Sylius/Bundle/CoreBundle/Resources/config/services/order_pay/controllers.php (1)

22-22: Unused $parameters variable.

$parameters is assigned but never referenced in this file. Consider removing it to keep the config clean.

♻️ Suggested fix
     $services = $container->services();
-    $parameters = $container->parameters();
src/Sylius/Bundle/CoreBundle/Resources/config/services/order_pay/providers.php (1)

24-24: Unused $parameters variable.

Same as in the controllers config — $parameters is assigned but never used.

♻️ Suggested fix
     $services = $container->services();
-    $parameters = $container->parameters();
src/Sylius/Bundle/CoreBundle/Resources/config/services/form.php (2)

91-95: Catalog promotion parameters defined in form config.

The parameters on lines 91–95 (sylius.catalog_promotion.action.*, sylius.catalog_promotion.scope.*) are catalog promotion type constants rather than form-specific config. They're only here because the form type tags reference them. If there's a dedicated catalog_promotion.php config file in this PR, consider defining these parameters there and relying on container parameter resolution at tag-attribute evaluation time — this would improve cohesion. Not blocking if this mirrors the original XML layout.


21-22: Minor: import ordering nit.

ProductsToCodesTransformer should precede ProductVariantsToCodesTransformer alphabetically.

Proposed fix
-use Sylius\Bundle\CoreBundle\Form\DataTransformer\ProductVariantsToCodesTransformer;
 use Sylius\Bundle\CoreBundle\Form\DataTransformer\ProductsToCodesTransformer;
+use Sylius\Bundle\CoreBundle\Form\DataTransformer\ProductVariantsToCodesTransformer;
 use Sylius\Bundle\CoreBundle\Form\DataTransformer\TaxonsToCodesTransformer;

As per coding guidelines: "Sort PHP use imports alphabetically and group by type (classes, functions, constants)".

src/Sylius/Bundle/CoreBundle/Resources/config/services/templating.php (1)

24-24: Unused $parameters variable.

$parameters is assigned but never used in this file. This pattern appears across multiple new config files in this PR. Consider removing it where unused, or if it's intentionally kept as a boilerplate for future additions, that's acceptable too.

src/Sylius/Bundle/CoreBundle/Resources/config/services.php (1)

279-281: Service ID sylius.assigner.customer_id refers to CustomerIpAssigner.

The ID says customer_id but the class is CustomerIpAssigner (IP assigner). This is likely a legacy naming carried over from the XML config, but it's worth noting for future cleanup.

src/Sylius/Bundle/CoreBundle/Resources/config/services/calculators.php (1)

19-26: Unused $parameters variable across all new config files.

$parameters is assigned on line 21 but never referenced. The same pattern appears in every new file in this PR. While this may be intentional boilerplate for future use, it adds unnecessary noise.

♻️ Suggested fix
 return static function (ContainerConfigurator $container) {
     $services = $container->services();
-    $parameters = $container->parameters();
 
     $services->set('sylius.calculator.delay_stamp', DelayStampCalculator::class);
src/Sylius/Bundle/CoreBundle/Resources/config/services/price_history/listeners.php (1)

22-24: Unused $parameters variable.

$parameters is assigned on line 24 but never referenced in this file. This pattern appears to be copied across multiple config files in this PR.

Proposed fix
 return static function (ContainerConfigurator $container) {
     $services = $container->services();
-    $parameters = $container->parameters();

Comment on lines +21 to +33
$services->set('sylius.oauth.user_provider', UserProvider::class)
->lazy()
->args([
'%sylius.model.shop_user.class%',
service('sylius.factory.customer'),
service('sylius.factory.shop_user'),
service('sylius.repository.shop_user'),
service('sylius.factory.oauth_user'),
service('sylius.repository.oauth_user'),
service('sylius.manager.shop_user'),
service('sylius.canonicalizer'),
service('sylius.repository.customer'),
]);
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:

#!/bin/bash
# 1. Find the commit that deleted the XML file
COMMIT=$(git log --all --oneline --diff-filter=D -- "**/integrations/hwi_oauth.xml" | head -1 | awk '{print $1}')
if [ -n "$COMMIT" ]; then
  echo "=== Original XML content (commit ${COMMIT}) ==="
  git show "${COMMIT}^:src/Sylius/Bundle/CoreBundle/Resources/config/services/integrations/hwi_oauth.xml" 2>/dev/null || echo "File not found"
  echo ""
fi

# 2. Check other PHP config files in the same directory for ->public() usage
echo "=== PHP config files in services/integrations/ with ->public() calls ==="
fd -type f -name "*.php" src/Sylius/Bundle/CoreBundle/Resources/config/services/integrations/ --exec grep -l "public()" {} \;
echo ""

# 3. Check a few PHP config files to see the pattern
echo "=== Sample PHP config files ==="
fd -type f -name "*.php" src/Sylius/Bundle/CoreBundle/Resources/config/services/ -type f | head -3 | while read f; do
  echo "File: $f"
  grep -A5 "->set(" "$f" | head -20
  echo ""
done

# 4. Look for references to sylius.oauth.user_provider in config files
echo "=== References to sylius.oauth.user_provider in config ==="
rg -n "sylius.oauth.user_provider" --type yaml --type xml src/Sylius/Bundle/CoreBundle/Resources/config/ 2>/dev/null | head -20

Repository: Sylius/Sylius

Length of output: 580


🏁 Script executed:

#!/bin/bash
# 1. Search for hwi_oauth.xml file (may still exist or in git history)
echo "=== Searching for hwi_oauth.xml ==="
find . -name "*hwi_oauth.xml" 2>/dev/null
echo ""

# 2. Check git history for this file
echo "=== Git history for hwi_oauth.xml ==="
git log --all --oneline -- "*hwi_oauth.xml" | head -5
echo ""

# 3. Look for the most recent version of the XML file before it was replaced
echo "=== Looking for original XML content in git ==="
git show HEAD~10:src/Sylius/Bundle/CoreBundle/Resources/config/services/integrations/hwi_oauth.xml 2>/dev/null | head -50
echo ""

# 4. Check PHP config files in integrations directory
echo "=== PHP files in integrations directory ==="
find src/Sylius/Bundle/CoreBundle/Resources/config/services/integrations/ -name "*.php" 2>/dev/null | head -10
echo ""

# 5. Sample from one of the config files to see the pattern
echo "=== Sample from a PHP config file ==="
find src/Sylius/Bundle/CoreBundle/Resources/config/services/ -name "*.php" -type f 2>/dev/null | head -1 | xargs head -60
echo ""

# 6. Search for references to sylius.oauth.user_provider using rg
echo "=== References to oauth.user_provider ==="
rg "oauth.user_provider" src/Sylius/Bundle/CoreBundle/Resources/ 2>/dev/null | head -20
echo ""

# 7. Check if hwi_oauth.php exists and verify the entire file
echo "=== Current hwi_oauth.php content ==="
cat src/Sylius/Bundle/CoreBundle/Resources/config/services/integrations/hwi_oauth.php

Repository: Sylius/Sylius

Length of output: 2694


🏁 Script executed:

#!/bin/bash
# 1. Check the commit that says "Make all Sylius services public"
echo "=== Commit: Make all Sylius services public ==="
git show cc00d97bd9 --stat | head -50
echo ""

# 2. Check if hwi_oauth.php or hwi_oauth.xml was modified in that commit
echo "=== Checking if hwi_oauth files are in that commit ==="
git show cc00d97bd9 -- "*hwi_oauth*" 2>/dev/null | head -100
echo ""

# 3. Get the detailed commit for the HWI OAuth adjustment
echo "=== Commit: c269961cdd HWI OAuth UserProvider service adjustment ==="
git show c269961cdd --stat | head -30
echo ""

# 4. Show the actual changes in that commit
echo "=== Changes in c269961cdd ==="
git show c269961cdd 2>/dev/null | head -150
echo ""

# 5. Check the commit message for more context
echo "=== Full commit message for c269961cdd ==="
git log -1 --format='%B' c269961cdd

Repository: Sylius/Sylius

Length of output: 6127


🏁 Script executed:

#!/bin/bash
# Find when hwi_oauth.xml was deleted/replaced with PHP
echo "=== Commits affecting hwi_oauth files ==="
git log --oneline --all -- "*hwi_oauth.xml" "*hwi_oauth.php" | head -20
echo ""

# Show the commit that introduced hwi_oauth.php
echo "=== Commit that introduced hwi_oauth.php ==="
git log --oneline --all -- "src/Sylius/Bundle/CoreBundle/Resources/config/services/integrations/hwi_oauth.php" | head -5
echo ""

# Get the full commit that converted XML to PHP (the most recent one)
COMMIT=$(git log --oneline --all -- "src/Sylius/Bundle/CoreBundle/Resources/config/services/integrations/hwi_oauth.php" | head -1 | awk '{print $1}')
echo "=== Full diff for conversion commit $COMMIT ==="
git show $COMMIT 2>/dev/null | head -200
echo ""

# Check if the original XML file still exists or was deleted
echo "=== Status of hwi_oauth.xml ==="
git log --oneline --diff-filter=D -- "*hwi_oauth.xml" | head -3

Repository: Sylius/Sylius

Length of output: 7318


🏁 Script executed:

#!/bin/bash
# Check the full current hwi_oauth.php to see if there's any defaults() call
echo "=== Full hwi_oauth.php content ==="
cat -n src/Sylius/Bundle/CoreBundle/Resources/config/services/integrations/hwi_oauth.php
echo ""

# Check if the XML still exists or was completely removed
echo "=== Check for deleted XML in git history ==="
git log --all --diff-filter=D -- "*hwi_oauth.xml" --oneline | head -5

Repository: Sylius/Sylius

Length of output: 1401


Add ->public() to the service definition.

The original XML file declared <defaults public="true" /> (commit cc00d97), making this service publicly accessible. When converting to PHP, this must be preserved by calling ->public() on the service.

$services->set('sylius.oauth.user_provider', UserProvider::class)
    ->public()
    ->lazy()
    ->args([

Without this, the service is private and will not be accessible to HWIOAuthBundle or other components that reference it directly.

🤖 Prompt for AI Agents
In
`@src/Sylius/Bundle/CoreBundle/Resources/config/services/integrations/hwi_oauth.php`
around lines 21 - 33, The service definition for 'sylius.oauth.user_provider'
(UserProvider::class) is missing public visibility; update the service
registration where $services->set('sylius.oauth.user_provider',
UserProvider::class) is called to make the service public by adding ->public()
(e.g. place ->public() before ->lazy()), so the provider remains accessible to
HWIOAuthBundle and other consumers.

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/CoreBundle/Resources/config/services.php`:
- Around line 100-103: The services.php import only globs services/*.php and is
missing the intermediate import files needed to pull in nested directories; add
two new intermediate files named services/integrations.php and
services/telemetry.php that each perform a ContainerConfigurator import of their
respective subdirectory (e.g., integrations/*.php and telemetry/*.php) so that
the files under services/integrations/ (doctrine/orm.php, hwi_oauth.php) and
services/telemetry/ (telemetry.php) are loaded when services.php runs.

In `@src/Sylius/Bundle/CoreBundle/Resources/config/services/promotion.php`:
- Around line 115-123: The service definition for
sylius.command.promotion_action.unit_fixed_discount passes five args to
UnitFixedDiscountPromotionActionCommand but its constructor accepts only four;
remove the fifth argument service('sylius.converter.currency') from the
->args([...]) array so the service only injects
service('sylius.factory.adjustment'),
service('sylius.filter.promotion.price_range'),
service('sylius.filter.promotion.taxon'), and
service('sylius.filter.promotion.product') to match the
UnitFixedDiscountPromotionActionCommand constructor.
🧹 Nitpick comments (13)
src/Sylius/Bundle/CoreBundle/Resources/config/services/installer_requirements.php (1)

23-23: Remove unused $parameters variable.

$parameters is assigned but never referenced in this file.

♻️ Proposed fix
     $services = $container->services();
-    $parameters = $container->parameters();
src/Sylius/Bundle/CoreBundle/Resources/config/services/factories.php (1)

21-21: Unused variable $parameters.

$container->parameters() is assigned but never referenced in this file. The payment.php file in this same PR doesn't include it, so this appears to be leftover boilerplate.

Proposed fix
 return static function (ContainerConfigurator $container) {
     $services = $container->services();
-    $parameters = $container->parameters();
 
     $services->set('sylius.custom_factory.order', OrderFactory::class)
src/Sylius/Bundle/CoreBundle/Resources/config/services/listeners/workflow/shipment.php (1)

21-21: Remove unused $parameters variable.

$parameters is assigned but never referenced in this file — likely a copy-paste artifact from a template.

🧹 Proposed fix
 return static function (ContainerConfigurator $container) {
     $services = $container->services();
-    $parameters = $container->parameters();

     $services->set('sylius.listener.workflow.shipment.resolve_order_shipment_state', ResolveOrderShipmentStateListener::class)
src/Sylius/Bundle/CoreBundle/Resources/config/services/mailer.php (1)

32-32: Unused $parameters variable.

$parameters is assigned but never referenced in this file. Remove it to keep the configuration clean.

♻️ Suggested fix
     $services = $container->services();
-    $parameters = $container->parameters();
src/Sylius/Bundle/CoreBundle/Resources/config/services/listeners.php (1)

41-41: Unused $parameters variable.

$parameters is assigned but never referenced anywhere in this file.

Proposed fix
     $services = $container->services();
-    $parameters = $container->parameters();
     $container->import('listeners/workflow/*.php');
src/Sylius/Bundle/CoreBundle/Resources/config/services/promotion.php (1)

62-62: Unused $parameters variable.

$container->parameters() is assigned but never referenced in this file.

Proposed fix
     $services = $container->services();
-    $parameters = $container->parameters();
src/Sylius/Bundle/CoreBundle/Resources/config/services/telemetry/telemetry.php (1)

46-46: Inconsistent : void return type on closure.

This is the only DI config file in the PR that adds : void to the closure signature. All others (e.g., templating.php, services.php, state_resolvers.php, payment.php, order_shipping.php) omit it. Consider aligning for consistency.

Suggested diff
-return static function (ContainerConfigurator $container): void {
+return static function (ContainerConfigurator $container) {
src/Sylius/Bundle/CoreBundle/Resources/config/services/listeners/workflow/order_payment.php (1)

19-30: Unused $parameters variable.

$parameters is assigned on line 21 but never referenced. This pattern repeats across all new config files in this PR.

Proposed fix
 return static function (ContainerConfigurator $container) {
     $services = $container->services();
-    $parameters = $container->parameters();

     $services->set('sylius.listener.workflow.order_payment.sell_order_inventory', SellOrderInventoryListener::class)
src/Sylius/Bundle/CoreBundle/Resources/config/services/fixtures_listeners.php (1)

23-24: The ->public() default has no effect since both services explicitly call ->private(). Either remove the default or remove the per-service ->private() calls.

Option A: Remove the unused default
-    $services->defaults()
-        ->public();
-
-    $services->set('sylius.fixture.listener.catalog_promotion_executor', CatalogPromotionExecutorListener::class)
-        ->private()
+    $services->set('sylius.fixture.listener.catalog_promotion_executor', CatalogPromotionExecutorListener::class)

(and likewise remove ->private() from the images_purger service)

Option B: Keep default private, drop per-service overrides
-    $services->defaults()
-        ->public();
-
-    $services->set('sylius.fixture.listener.catalog_promotion_executor', CatalogPromotionExecutorListener::class)
-        ->private()
+    $services->set('sylius.fixture.listener.catalog_promotion_executor', CatalogPromotionExecutorListener::class)
src/Sylius/Bundle/CoreBundle/Resources/config/services/price_history/logger.php (1)

19-31: Unused $parameters variable.

$parameters is assigned on line 21 but never used in this file. This pattern appears to be repeated across multiple files in this PR. Consider removing it from files where it's not needed to keep the configuration clean.

♻️ Suggested fix
 return static function (ContainerConfigurator $container) {
     $services = $container->services();
-    $parameters = $container->parameters();

     $services->set('sylius.logger.price_history.price_change', PriceChangeLogger::class)
src/Sylius/Bundle/CoreBundle/Resources/config/services/command_handler.php (1)

23-24: Unused $parameters variable.

$parameters is assigned but never used in this file. This pattern repeats across several new config files in this PR (e.g., context.php, catalog_promotion/listeners.php, listeners/workflow/order.php). Consider removing these unused assignments for clarity.

Suggested fix
     $services = $container->services();
-    $parameters = $container->parameters();
src/Sylius/Bundle/CoreBundle/Resources/config/services/order_processing.php (1)

29-31: Consider breaking long parameter definitions across multiple lines for readability.

Line 31 is quite long. While functionally correct, wrapping the array elements would improve readability and make diffs cleaner.

Suggested formatting
-    $parameters->set('sylius.order_processing.adjustment_clearing_types', [AdjustmentInterface::ORDER_ITEM_PROMOTION_ADJUSTMENT, AdjustmentInterface::ORDER_PROMOTION_ADJUSTMENT, AdjustmentInterface::ORDER_SHIPPING_PROMOTION_ADJUSTMENT, AdjustmentInterface::ORDER_UNIT_PROMOTION_ADJUSTMENT, AdjustmentInterface::SHIPPING_ADJUSTMENT, AdjustmentInterface::TAX_ADJUSTMENT]);
+    $parameters->set('sylius.order_processing.adjustment_clearing_types', [
+        AdjustmentInterface::ORDER_ITEM_PROMOTION_ADJUSTMENT,
+        AdjustmentInterface::ORDER_PROMOTION_ADJUSTMENT,
+        AdjustmentInterface::ORDER_SHIPPING_PROMOTION_ADJUSTMENT,
+        AdjustmentInterface::ORDER_UNIT_PROMOTION_ADJUSTMENT,
+        AdjustmentInterface::SHIPPING_ADJUSTMENT,
+        AdjustmentInterface::TAX_ADJUSTMENT,
+    ]);
src/Sylius/Bundle/CoreBundle/Resources/config/services/fixtures.php (1)

44-44: Remove unused $parameters variable.

$parameters is assigned but never referenced anywhere in this file.

Proposed fix
     $services = $container->services();
-    $parameters = $container->parameters();

Comment on lines +100 to +103
return static function (ContainerConfigurator $container) {
$services = $container->services();
$parameters = $container->parameters();
$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 | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify that all service subdirectories have an intermediate import file
# in the services/ directory that imports their contents.

echo "=== PHP files directly in services/ (matched by services/*.php glob) ==="
fd --type f --max-depth 1 -e php . src/Sylius/Bundle/CoreBundle/Resources/config/services/

echo ""
echo "=== Subdirectories in services/ ==="
fd --type d --max-depth 1 . src/Sylius/Bundle/CoreBundle/Resources/config/services/

echo ""
echo "=== Checking for import() calls in top-level service files ==="
rg -n 'import\(' src/Sylius/Bundle/CoreBundle/Resources/config/services/*.php 2>/dev/null || echo "No import calls found in top-level service files"

echo ""
echo "=== All PHP config files in services/ tree ==="
fd --type f -e php . src/Sylius/Bundle/CoreBundle/Resources/config/services/ | sort

Repository: Sylius/Sylius

Length of output: 8866


Missing intermediate import files for integrations/ and telemetry/ subdirectories.

The services/*.php glob pattern correctly chains to subdirectories via intermediate import files (catalog_promotion.php, listeners.php, order_pay.php, price_history.php). However, two subdirectories are not imported:

  • services/integrations/ (contains doctrine/orm.php, hwi_oauth.php) — needs services/integrations.php
  • services/telemetry/ (contains telemetry.php) — needs services/telemetry.php

Services in these directories will not be loaded. Create the missing intermediate files to chain-import their contents.

🤖 Prompt for AI Agents
In `@src/Sylius/Bundle/CoreBundle/Resources/config/services.php` around lines 100
- 103, The services.php import only globs services/*.php and is missing the
intermediate import files needed to pull in nested directories; add two new
intermediate files named services/integrations.php and services/telemetry.php
that each perform a ContainerConfigurator import of their respective
subdirectory (e.g., integrations/*.php and telemetry/*.php) so that the files
under services/integrations/ (doctrine/orm.php, hwi_oauth.php) and
services/telemetry/ (telemetry.php) are loaded when services.php runs.

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

🤖 Fix all issues with AI agents
In
`@src/Sylius/Bundle/CoreBundle/Resources/config/services/listeners/workflow/order_payment.php`:
- Line 21: Remove the unused assignment to $parameters that calls
$container->parameters(): delete the line containing "$parameters =
$container->parameters();" (it is never referenced anywhere in this DI config).
Ensure no other logic depends on $parameters; if any future use is intended,
reference $container->parameters() directly where needed instead of keeping the
unused variable.

In
`@src/Sylius/Bundle/CoreBundle/Resources/config/services/price_history/listeners.php`:
- Around line 26-47: The OnFlushEntityObserverListener contains a typo using
$mail->isEntityChanged(...) instead of the instance method; update the call in
OnFlushEntityObserverListener (where it invokes isEntityChanged) to use
$this->isEntityChanged(...) so the listener correctly calls its own method
(ensure any other similar incorrect $mail or wrong-variable references in that
class are corrected to $this).

In
`@src/Sylius/Bundle/CoreBundle/Resources/config/services/product_variant_map.php`:
- Line 26: The variable $parameters is declared but never used in
product_variant_map.php; remove the unused declaration ($parameters =
$container->parameters();) to eliminate dead code and avoid warnings. Locate the
line that assigns $parameters and delete it, ensuring no other code references
$parameters afterwards and that the file still returns/uses $container as
intended.

In `@src/Sylius/Bundle/CoreBundle/Resources/config/services/promotion.php`:
- Around line 106-113: The service definition for
sylius.command.promotion_action.fixed_discount is passing four constructor args
but FixedDiscountPromotionActionCommand only accepts three; remove the fourth
argument (service('sylius.converter.currency')) from the ->args([...]) array so
the args list only includes service('sylius.distributor.proportional_integer'),
service('sylius.applicator.promotion.units_adjustments'), and
service('sylius.distributor.minimum_price') to match the
FixedDiscountPromotionActionCommand constructor signature.
🧹 Nitpick comments (19)
src/Sylius/Bundle/CoreBundle/Resources/config/services/installer_requirements.php (1)

23-23: $parameters is assigned but never used.

This variable is dead code in this file — consider removing it.

♻️ Suggested fix
     $services = $container->services();
-    $parameters = $container->parameters();
src/Sylius/Bundle/CoreBundle/Resources/config/services/listeners/workflow/order_shipping.php (1)

20-20: Unused $parameters variable.

$parameters is assigned but never referenced in this file. Remove it to keep the configuration clean.

🧹 Suggested fix
 return static function (ContainerConfigurator $container) {
     $services = $container->services();
-    $parameters = $container->parameters();

     $services->set('sylius.listener.workflow.order_shipping.resolve_order_state', ResolveOrderStateListener::class)
src/Sylius/Bundle/CoreBundle/Resources/config/services/mailer.php (1)

30-32: Unused $parameters variable.

$parameters is assigned on line 32 but never referenced anywhere in this file. Remove it to keep the configuration clean.

♻️ Proposed fix
 return static function (ContainerConfigurator $container) {
     $services = $container->services();
-    $parameters = $container->parameters();
src/Sylius/Bundle/CoreBundle/Resources/config/services/context.php (1)

31-31: Unused $parameters variable.

$parameters is assigned but never referenced in this file. Remove it to avoid dead code.

Proposed fix
     $services = $container->services();
-    $parameters = $container->parameters();
src/Sylius/Bundle/CoreBundle/Resources/config/services/taxation.php (1)

62-74: Nit: order tag attribute keys alphabetically.

As per coding guidelines, array keys should be ordered alphabetically where applicable. 'label' should precede 'type'.

Proposed fix
     $services->set('sylius.strategy.taxation.tax_calculation.order_items_based', TaxCalculationStrategy::class)
         ->args([
             'order_items_based',
             tagged_iterator('sylius.taxation.items.applicator'),
         ])
-        ->tag('sylius.taxation.calculation_strategy', ['type' => 'order_items_based', 'label' => 'Order items based']);
+        ->tag('sylius.taxation.calculation_strategy', ['label' => 'Order items based', 'type' => 'order_items_based']);
 
     $services->set('sylius.strategy.taxation.tax_calculation.order_item_units_based', TaxCalculationStrategy::class)
         ->args([
             'order_item_units_based',
             tagged_iterator('sylius.taxation.item_units.applicator'),
         ])
-        ->tag('sylius.taxation.calculation_strategy', ['type' => 'order_item_units_based', 'label' => 'Order item units based']);
+        ->tag('sylius.taxation.calculation_strategy', ['label' => 'Order item units based', 'type' => 'order_item_units_based']);

As per coding guidelines: "Order PHP array keys alphabetically where applicable".

src/Sylius/Bundle/CoreBundle/Resources/config/services/listeners.php (1)

41-41: Unused $parameters variable.

$parameters is assigned but never referenced in this file. Remove it to avoid dead code.

🧹 Suggested fix
     $services = $container->services();
-    $parameters = $container->parameters();
     $container->import('listeners/workflow/*.php');
src/Sylius/Bundle/CoreBundle/Resources/config/services/fixtures_factories.php (1)

41-46: Unused $parameters variable.

$parameters is assigned on line 43 but never referenced anywhere in this file. Consider removing it.

🧹 Suggested fix
 return static function (ContainerConfigurator $container) {
     $services = $container->services();
-    $parameters = $container->parameters();

     $services->defaults()
         ->public();
src/Sylius/Bundle/CoreBundle/Resources/config/services/fixtures.php (1)

42-44: Unused $parameters variable.

Same as in fixtures_factories.php$parameters is assigned but never used.

🧹 Suggested fix
 return static function (ContainerConfigurator $container) {
     $services = $container->services();
-    $parameters = $container->parameters();
src/Sylius/Bundle/CoreBundle/Resources/config/services/promotion.php (1)

62-62: Unused $parameters variable.

$container->parameters() is called and assigned but never referenced in this file. Remove it to avoid dead code.

Suggested fix
     $services = $container->services();
-    $parameters = $container->parameters();
src/Sylius/Bundle/CoreBundle/Resources/config/services/listeners/workflow/order_checkout.php (1)

25-25: Unused $parameters variable.

$parameters is assigned but never referenced in this file. Likely a copy-paste artifact.

🧹 Suggested removal
     $services = $container->services();
-    $parameters = $container->parameters();
src/Sylius/Bundle/CoreBundle/Resources/config/services/catalog_promotion/checkers.php (1)

24-26: Unused $parameters variable.

$parameters is assigned on Line 26 but never referenced in this file.

🧹 Suggested fix
 return static function (ContainerConfigurator $container) {
     $services = $container->services();
-    $parameters = $container->parameters();
src/Sylius/Bundle/CoreBundle/Resources/config/services/catalog_promotion/calculators.php (1)

21-23: Unused $parameters variable — same as in checkers.php.

🧹 Suggested fix
 return static function (ContainerConfigurator $container) {
     $services = $container->services();
-    $parameters = $container->parameters();
src/Sylius/Bundle/CoreBundle/Resources/config/services/catalog_promotion/processors.php (1)

29-31: Unused $parameters variable — same pattern as other files in this PR.

src/Sylius/Bundle/CoreBundle/Resources/config/services/order_pay/providers.php (1)

22-24: Unused $parameters variable.

src/Sylius/Bundle/CoreBundle/Resources/config/services/console_command.php (1)

28-30: Unused $parameters variable.

src/Sylius/Bundle/CoreBundle/Resources/config/services/checkers.php (1)

25-27: Unused $parameters variable.

src/Sylius/Bundle/CoreBundle/Resources/config/services/order_processing.php (1)

29-31: Consider splitting the long parameter lines for readability.

Lines 29–31, especially line 31 with six AdjustmentInterface::* constants, are quite wide. Breaking them into multi-line arrays would improve readability and make diffs cleaner.

♻️ Suggested formatting
-    $parameters->set('sylius.order_payment_processor.checkout.unsupported_states', [OrderInterface::STATE_CANCELLED, OrderInterface::STATE_FULFILLED]);
-    $parameters->set('sylius.order_payment_processor.after_checkout.unsupported_states', [OrderInterface::STATE_CANCELLED, OrderInterface::STATE_FULFILLED]);
-    $parameters->set('sylius.order_processing.adjustment_clearing_types', [AdjustmentInterface::ORDER_ITEM_PROMOTION_ADJUSTMENT, AdjustmentInterface::ORDER_PROMOTION_ADJUSTMENT, AdjustmentInterface::ORDER_SHIPPING_PROMOTION_ADJUSTMENT, AdjustmentInterface::ORDER_UNIT_PROMOTION_ADJUSTMENT, AdjustmentInterface::SHIPPING_ADJUSTMENT, AdjustmentInterface::TAX_ADJUSTMENT]);
+    $parameters->set('sylius.order_payment_processor.checkout.unsupported_states', [
+        OrderInterface::STATE_CANCELLED,
+        OrderInterface::STATE_FULFILLED,
+    ]);
+    $parameters->set('sylius.order_payment_processor.after_checkout.unsupported_states', [
+        OrderInterface::STATE_CANCELLED,
+        OrderInterface::STATE_FULFILLED,
+    ]);
+    $parameters->set('sylius.order_processing.adjustment_clearing_types', [
+        AdjustmentInterface::ORDER_ITEM_PROMOTION_ADJUSTMENT,
+        AdjustmentInterface::ORDER_PROMOTION_ADJUSTMENT,
+        AdjustmentInterface::ORDER_SHIPPING_PROMOTION_ADJUSTMENT,
+        AdjustmentInterface::ORDER_UNIT_PROMOTION_ADJUSTMENT,
+        AdjustmentInterface::SHIPPING_ADJUSTMENT,
+        AdjustmentInterface::TAX_ADJUSTMENT,
+    ]);

As per coding guidelines, use trailing commas in multi-line PHP arrays.

src/Sylius/Bundle/CoreBundle/Resources/config/services/catalog_promotion/listeners.php (1)

30-30: Unused $parameters variable.

$parameters is assigned but never referenced in this file. Remove it to keep the config clean.

♻️ Proposed fix
     $services = $container->services();
-    $parameters = $container->parameters();
src/Sylius/Bundle/CoreBundle/Resources/config/services/price_history/listeners.php (1)

24-24: Unused $parameters variable.

Same as in catalog_promotion/listeners.php$parameters is assigned but never used.

♻️ Proposed fix
     $services = $container->services();
-    $parameters = $container->parameters();

Comment on lines +26 to +47
$services->set('sylius.entity_observer.price_history.create_log_entry_on_price_change', CreateLogEntryOnPriceChangeObserver::class)
->args([service('sylius.logger.price_history.price_change')])
->tag('sylius.entity_observer');

$services->set('sylius.entity_observer.price_history.process_lowest_prices_on_channel_change', ProcessLowestPricesOnChannelChangeObserver::class)
->args([service('sylius.command_dispatcher.price_history.batched_apply_lowest_price_on_channel_pricings')])
->tag('sylius.entity_observer');

$services->set('sylius.entity_observer.price_history.process_lowest_prices_on_channel_price_history_config_change', ProcessLowestPricesOnChannelPriceHistoryConfigChangeObserver::class)
->args([
service('sylius.repository.channel'),
service('sylius.command_dispatcher.price_history.batched_apply_lowest_price_on_channel_pricings'),
])
->tag('sylius.entity_observer');

$services->set('sylius.listener.price_history.on_flush_entity_observer', OnFlushEntityObserverListener::class)
->args([tagged_iterator('sylius.entity_observer')])
->tag('doctrine.event_listener', ['event' => 'onFlush', 'lazy' => true]);

$services->set('sylius.listener.price_history.channel_pricing_log_entry', ChannelPricingLogEntryEventListener::class)
->args([service('sylius.processor.price_history.product_lowest_price_before_discount')])
->tag('doctrine.event_listener', ['event' => 'postPersist', 'priority' => 500, 'connection' => 'default']);
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

Service wiring matches constructor signatures.

Verified against the relevant code snippets:

  • ProcessLowestPricesOnChannelChangeObserver takes one ApplyLowestPriceOnChannelPricingsCommandDispatcherInterface arg ✓
  • ProcessLowestPricesOnChannelPriceHistoryConfigChangeObserver takes ChannelRepositoryInterface + command dispatcher ✓
  • OnFlushEntityObserverListener takes iterable $entityObservers via tagged_iterator('sylius.entity_observer')

Note: The relevant snippet for OnFlushEntityObserverListener (at OnFlushEntityObserverListener.php line ~47) contains $mail->isEntityChanged(...) which appears to be a typo for $this->isEntityChanged(...). This would cause a runtime error when the listener fires. While not part of this DI config file, the listener wired here would fail.

#!/bin/bash
# Verify the $mail typo in OnFlushEntityObserverListener
fd "OnFlushEntityObserverListener.php" --type f --exec cat {}
🤖 Prompt for AI Agents
In
`@src/Sylius/Bundle/CoreBundle/Resources/config/services/price_history/listeners.php`
around lines 26 - 47, The OnFlushEntityObserverListener contains a typo using
$mail->isEntityChanged(...) instead of the instance method; update the call in
OnFlushEntityObserverListener (where it invokes isEntityChanged) to use
$this->isEntityChanged(...) so the listener correctly calls its own method
(ensure any other similar incorrect $mail or wrong-variable references in that
class are corrected to $this).

@TheMilek TheMilek merged commit bfdb714 into Sylius:2.3 Feb 6, 2026
35 of 36 checks passed
@loic425 loic425 deleted the xml2php/core 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.

2 participants