Conversation
📝 WalkthroughWalkthroughMigrates Sylius AdminBundle DI configuration from XML to PHP by replacing XmlFileLoader with PhpFileLoader in the extension and converting many service files (.xml → .php). Also reorders an entry block in Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
❌ Preview Environment deleted from BunnyshellAvailable commands:
|
3c5e669 to
ee7ac8f
Compare
ee7ac8f to
14c64ff
Compare
There was a problem hiding this comment.
Actionable comments posted: 8
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/AdminBundle/Resources/config/services/menu.php`:
- Around line 1-5: Add the strict types declaration and correct PSR-12 spacing:
insert declare(strict_types=1); as the very first non-opening token in the file,
and change the anonymous exportable callable signature from "static
function(ContainerConfigurator $container)" to "static function
(ContainerConfigurator $container)" (note the space between function and
parenthesis) so the ContainerConfigurator parameter remains typed; ensure no
other file-level tokens precede the declare statement.
In `@src/Sylius/Bundle/AdminBundle/Resources/config/services/query_function.php`:
- Around line 1-6: Add a strict types declaration and an explicit void return
type on the returned configuration closure: add "declare(strict_types=1);" at
the top of the file and change the returned static function signature from
"static function(ContainerConfigurator $container)" to "static
function(ContainerConfigurator $container): void" so the file follows the
project's PHP typing and signature guidelines; keep the rest of the closure body
(e.g., $services = $container->services()) unchanged.
In `@src/Sylius/Bundle/AdminBundle/Resources/config/services/twig.php`:
- Around line 1-6: Add a strict types declaration and a void return type to the
service config closure: insert "declare(strict_types=1);" at the top of the PHP
file and change the anonymous function signature from "static
function(ContainerConfigurator $container)" to "static
function(ContainerConfigurator $container): void" so the closure has an explicit
return type; the change targets the closure that accepts ContainerConfigurator
($container) in this twig.php config file.
In `@src/Sylius/Bundle/AdminBundle/Resources/config/services/twig/component.php`:
- Around line 89-96: The service sylius_admin.twig.component.payment_method.form
is tagged incorrectly: update its tag from 'sylius.twig_component' to
'sylius.live_component.admin' so it matches the other ResourceFormComponent
services; locate the service definition for
sylius_admin.twig.component.payment_method.form (class
Sylius\Bundle\UiBundle\Twig\Component\ResourceFormComponent) and replace the
->tag('sylius.twig_component', ['key' => 'sylius_admin:payment_method:form'])
call with ->tag('sylius.live_component.admin', ['key' =>
'sylius_admin:payment_method:form']) ensuring the key stays the same.
In
`@src/Sylius/Bundle/AdminBundle/Resources/config/services/twig/component/promotion_coupon.php`:
- Around line 1-6: Add a strict types declaration at the top of the PHP file and
give the configurator closure an explicit void return type: insert
declare(strict_types=1); immediately after the opening <?php tag, and change the
anonymous function signature from "static function(ContainerConfigurator
$container)" to "static function(ContainerConfigurator $container): void" so the
closure is explicitly typed; keep the rest of the body and return value behavior
the same.
In
`@src/Sylius/Bundle/AdminBundle/Resources/config/services/twig/component/taxon.php`:
- Around line 1-6: Add a file-level declare(strict_types=1); and change the
configurator closure signature return type from implicit to explicit void by
updating the returned function signature (return static
function(ContainerConfigurator $container): void { ... });, and update the
multi-line argument/array lists used in the service definitions (the multi-line
argument lists in the configurator where services are defined) to include
trailing commas on each line of those multi-line arrays/argument lists; ensure
no other behavior changes.
In
`@src/Sylius/Bundle/AdminBundle/Resources/config/services/twig/component/zone.php`:
- Around line 1-6: Add the strict types declaration and a void return type for
the configuration closure: insert declare(strict_types=1); immediately after the
opening <?php, and change the returned closure signature from "return static
function(ContainerConfigurator $container) {" to "return static function
(ContainerConfigurator $container): void {" (note the space before the parameter
list and the : void return type), targeting the closure that accepts
ContainerConfigurator $container.
In
`@src/Sylius/Bundle/AdminBundle/Resources/config/services/twig/error_template_finder.php`:
- Around line 1-6: Add a strict types declaration at the top of the PHP file and
give the returned closure an explicit void return type: insert
declare(strict_types=1); as the first statement and change the returned static
function signature (the closure that accepts ContainerConfigurator $container)
to include : void so it becomes static function(ContainerConfigurator
$container): void { ... }.
🟡 Minor comments (21)
src/Sylius/Bundle/AdminBundle/Resources/config/services/twig/component/order.php-1-5 (1)
1-5:⚠️ Potential issue | 🟡 MinorMissing
declare(strict_types=1);and return type on closure.As per coding guidelines, all PHP files must declare
strict_types=1and include type declarations for return values.Proposed fix
<?php +declare(strict_types=1); + namespace Symfony\Component\DependencyInjection\Loader\Configurator; -return static function(ContainerConfigurator $container) { +return static function (ContainerConfigurator $container): void { $services = $container->services();src/Sylius/Bundle/AdminBundle/Resources/config/services/twig/component/customer.php-1-3 (1)
1-3:⚠️ Potential issue | 🟡 MinorMissing
declare(strict_types=1);statement.As per coding guidelines, declare
strict_types=1at the beginning of all PHP files.Proposed fix
<?php +declare(strict_types=1); + namespace Symfony\Component\DependencyInjection\Loader\Configurator;src/Sylius/Bundle/AdminBundle/Resources/config/services/twig/component/product_variant.php-1-5 (1)
1-5:⚠️ Potential issue | 🟡 MinorAdd strict types and a closure return type.
Line 1 is missing
declare(strict_types=1);, and Line 5 should declare a return type for the configurator closure.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=1at the beginning of all PHP files” and “Add type declarations for all properties, arguments, and return values in PHP code.”src/Sylius/Bundle/AdminBundle/Resources/config/services/twig/component/shipment.php-1-6 (1)
1-6:⚠️ Potential issue | 🟡 MinorAdd
strict_typesand avoidreturn type for the configurator closure.This aligns the file with PHP typing rules and keeps the closure contract explicit.
💡 Proposed fix
-<?php +<?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();As per coding guidelines, Declare
strict_types=1at the beginning of all PHP files and Add type declarations for all properties, arguments, and return values in PHP code.src/Sylius/Bundle/AdminBundle/Resources/config/services/twig/component/shipment.php-8-14 (1)
8-14:⚠️ Potential issue | 🟡 MinorUse class constants with
useimports instead of string FQCNs.This keeps references refactor-safe and matches the repo’s PHP style.
💡 Proposed fix
namespace Symfony\Component\DependencyInjection\Loader\Configurator; +use Sylius\Bundle\AdminBundle\Form\Type\ShipmentShipType; +use Sylius\Bundle\AdminBundle\Twig\Component\Shipment\ShipFormComponent; return static function (ContainerConfigurator $container): void { $services = $container->services(); - $services->set('sylius_admin.twig.component.shipment.ship_form', 'Sylius\Bundle\AdminBundle\Twig\Component\Shipment\ShipFormComponent') + $services->set('sylius_admin.twig.component.shipment.ship_form', ShipFormComponent::class) ->args([ service('sylius.repository.shipment'), service('form.factory'), '%sylius.model.shipment.class%', - 'Sylius\Bundle\AdminBundle\Form\Type\ShipmentShipType', + ShipmentShipType::class, ]) ->tag('sylius.live_component.admin', ['key' => 'sylius_admin:shipment:ship_form']); };As per coding guidelines, Use
usestatements for all non-global classes in PHP.src/Sylius/Bundle/AdminBundle/Resources/config/services/form.php-1-6 (1)
1-6:⚠️ Potential issue | 🟡 MinorAdd
declare(strict_types=1)to the file.Line 1 should declare strict types per the coding guidelines. This is already being applied across other config files in the codebase (88 similar files already have this declaration).
Proposed fix
<?php +declare(strict_types=1); namespace Symfony\Component\DependencyInjection\Loader\Configurator;src/Sylius/Bundle/AdminBundle/Resources/config/services/twig/component/product_attribute.php-1-6 (1)
1-6:⚠️ Potential issue | 🟡 MinorAdd
declare(strict_types=1);at the beginning of the file.Line 1 should include the strict types declaration per the coding guidelines. This aligns with the pattern adopted in other bundles like PayumBundle and UiBundle.
Proposed fix
<?php +declare(strict_types=1); namespace Symfony\Component\DependencyInjection\Loader\Configurator; return static function(ContainerConfigurator $container) {Note: Return type declarations on service config closures are not used elsewhere in the codebase, so that portion of the original suggestion should be omitted.
src/Sylius/Bundle/AdminBundle/Resources/config/services/twig/component/product_option.php-1-6 (1)
1-6:⚠️ Potential issue | 🟡 MinorAdd strict types and a void return type to the config closure.
This file is missing
declare(strict_types=1);and the closure lacks an explicit: voidreturn type, both required by the coding guidelines.🔧 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/AdminBundle/Resources/config/services/email.php-1-6 (1)
1-6:⚠️ Potential issue | 🟡 MinorAdd
declare(strict_types=1)and explicit return type to the configurator closure.The file is missing the
declare(strict_types=1);statement at the beginning and the closure lacks an explicit: voidreturn type, both required by the PHP coding guidelines.🔧 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/AdminBundle/Resources/config/services/twig/component/product.php-1-6 (1)
1-6:⚠️ Potential issue | 🟡 MinorAdd
declare(strict_types=1);and: voidreturn type to the config closure.This file is missing the strict types declaration and the configurator closure lacks an explicit return type, both required by the coding guidelines.
🔧 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/AdminBundle/Resources/config/services/product/form.php-1-6 (1)
1-6:⚠️ Potential issue | 🟡 MinorAdd
declare(strict_types=1);to the file.This config file is missing the required
declare(strict_types=1);declaration at the beginning. Other DI config files in the codebase include this declaration after the opening<?phptag and before the namespace.🔧 Proposed fix
<?php +declare(strict_types=1); + namespace Symfony\Component\DependencyInjection\Loader\Configurator;As per coding guidelines: "Declare
strict_types=1at the beginning of all PHP files".src/Sylius/Bundle/AdminBundle/Resources/config/services/grid.php-1-6 (1)
1-6:⚠️ Potential issue | 🟡 MinorAdd strict types and void return type to the config closure.
This file is missing
declare(strict_types=1);at the top and the configurator closure lacks an explicit: voidreturn type, both required by the coding guidelines and Symfony PHP configuration standards.🔧 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=1at the beginning of all PHP files" and "Add type declarations for all properties, arguments, and return values in PHP code".src/Sylius/Bundle/AdminBundle/Resources/config/services/integrations/shop.php-1-6 (1)
1-6:⚠️ Potential issue | 🟡 MinorAdd strict types and a
voidreturn type to the config closure.🛠️ 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=1at the beginning of all PHP files; Add type declarations for all properties, arguments, and return values in PHP code.src/Sylius/Bundle/AdminBundle/Resources/config/services/twig/component/dashboard.php-1-6 (1)
1-6:⚠️ Potential issue | 🟡 MinorAdd strict types and a
voidreturn type to the config closure.🛠️ 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=1at the beginning of all PHP files; Add type declarations for all properties, arguments, and return values in PHP code.src/Sylius/Bundle/AdminBundle/Resources/config/services/twig/component/dashboard/pending_action.php-1-6 (1)
1-6:⚠️ Potential issue | 🟡 MinorAdd strict types and a
voidreturn type to the config closure.🛠️ 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=1at the beginning of all PHP files; Add type declarations for all properties, arguments, and return values in PHP code.src/Sylius/Bundle/AdminBundle/Resources/config/services/notification.php-1-6 (1)
1-6:⚠️ Potential issue | 🟡 MinorAdd strict types and a
voidreturn type to the config closure.🛠️ 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=1at the beginning of all PHP files; Add type declarations for all properties, arguments, and return values in PHP code.src/Sylius/Bundle/AdminBundle/Resources/config/services/controller.php-1-6 (1)
1-6:⚠️ Potential issue | 🟡 MinorAdd strict types and a
voidreturn type to the config closure.🛠️ 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=1at the beginning of all PHP files; Add type declarations for all properties, arguments, and return values in PHP code.src/Sylius/Bundle/AdminBundle/Resources/config/services/listener.php-1-6 (1)
1-6:⚠️ Potential issue | 🟡 MinorAdd strict types and a
voidreturn type to the config closure.🛠️ 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=1at the beginning of all PHP files; Add type declarations for all properties, arguments, and return values in PHP code.src/Sylius/Bundle/AdminBundle/Resources/config/services/pending_action.php-1-6 (1)
1-6:⚠️ Potential issue | 🟡 MinorAdd strict types and a
voidreturn type to the config closure.🛠️ 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=1at the beginning of all PHP files; Add type declarations for all properties, arguments, and return values in PHP code.src/Sylius/Bundle/AdminBundle/Resources/config/services.php-1-3 (1)
1-3:⚠️ Potential issue | 🟡 MinorMissing
declare(strict_types=1);statement.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;src/Sylius/Bundle/AdminBundle/Resources/config/services/twig/component.php-1-3 (1)
1-3:⚠️ Potential issue | 🟡 MinorMissing
declare(strict_types=1);statement.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;
🧹 Nitpick comments (2)
src/Sylius/Bundle/AdminBundle/Resources/config/services/twig/component/customer.php (1)
8-8: Consider using::classconstant for the service class.Using the
::classconstant with ausestatement improves IDE support, enables better refactoring, and catches typos at static analysis time.Proposed refactor
<?php +declare(strict_types=1); + namespace Symfony\Component\DependencyInjection\Loader\Configurator; +use Sylius\Bundle\AdminBundle\Twig\Component\Customer\OrderStatisticsComponent; + return static function(ContainerConfigurator $container) { $services = $container->services(); - $services->set('sylius_admin.twig.component.customer.order_statistics', 'Sylius\Bundle\AdminBundle\Twig\Component\Customer\OrderStatisticsComponent') + $services->set('sylius_admin.twig.component.customer.order_statistics', OrderStatisticsComponent::class) ->args([ service('sylius.repository.customer'), service('sylius.provider.statistics.customer'), ]) ->tag('sylius.live_component.admin', ['key' => 'sylius_admin:customer:order_statistics']); };src/Sylius/Bundle/AdminBundle/Resources/config/services/twig/component/promotion_coupon.php (1)
8-21: Use::classconstants with imports instead of string FQCNs.This aligns with the guideline to use imports and modern PHP class references.
♻️ Proposed refactor
namespace Symfony\Component\DependencyInjection\Loader\Configurator; +use Sylius\Bundle\AdminBundle\Form\Type\PromotionCouponGeneratorInstructionType; +use Sylius\Bundle\AdminBundle\Form\Type\PromotionCouponType; +use Sylius\Bundle\AdminBundle\Twig\Component\PromotionCoupon\GeneratorInstructionFormComponent; +use Sylius\Bundle\UiBundle\Twig\Component\ResourceFormComponent; + return static function (ContainerConfigurator $container): void { $services = $container->services(); - $services->set('sylius_admin.twig.component.promotion_coupon.form', 'Sylius\Bundle\UiBundle\Twig\Component\ResourceFormComponent') + $services->set('sylius_admin.twig.component.promotion_coupon.form', ResourceFormComponent::class) ->args([ service('sylius.repository.promotion_coupon'), service('form.factory'), '%sylius.model.promotion_coupon.class%', - 'Sylius\Bundle\AdminBundle\Form\Type\PromotionCouponType', + PromotionCouponType::class, ]) ->tag('sylius.live_component.admin', ['key' => 'sylius_admin:promotion_coupon:form']); - $services->set('sylius_admin.twig.component.promotion_coupon.generator_instruction_form', 'Sylius\Bundle\AdminBundle\Twig\Component\PromotionCoupon\GeneratorInstructionFormComponent') + $services->set('sylius_admin.twig.component.promotion_coupon.generator_instruction_form', GeneratorInstructionFormComponent::class) ->args([ service('form.factory'), - '\Sylius\Bundle\AdminBundle\Form\Type\PromotionCouponGeneratorInstructionType', + PromotionCouponGeneratorInstructionType::class, ]) ->tag('sylius.live_component.admin', ['key' => 'sylius_admin:promotion_coupon:generator_instruction_form']); };As per coding guidelines: "Use
usestatements for all non-global classes in PHP" and "Use modern PHP 8.2+ syntax and features".
src/Sylius/Bundle/AdminBundle/Resources/config/services/menu.php
Outdated
Show resolved
Hide resolved
src/Sylius/Bundle/AdminBundle/Resources/config/services/query_function.php
Show resolved
Hide resolved
| <?php | ||
|
|
||
| namespace Symfony\Component\DependencyInjection\Loader\Configurator; | ||
|
|
||
| return static function(ContainerConfigurator $container) { | ||
| $services = $container->services(); |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# Search for other twig.php or similar service configuration files
find src -name "*.php" -path "*/config/services/*" -type f | head -20Repository: Sylius/Sylius
Length of output: 1587
🏁 Script executed:
# Check if any existing service configuration files have strict_types declarations
rg "declare\(strict_types" src --type php -B 2 -A 2Repository: Sylius/Sylius
Length of output: 50371
🏁 Script executed:
# Look at a few other service configuration files to understand the pattern
find src -name "*.php" -path "*/config/services/*" -type f -exec head -10 {} + | head -50Repository: Sylius/Sylius
Length of output: 2138
🏁 Script executed:
# Check UserBundle config files that have strict_types to see if they have return types
head -10 src/Sylius/Bundle/UserBundle/Resources/config/services.php
head -10 src/Sylius/Bundle/UserBundle/Resources/config/services/integrations/doctrine/orm.phpRepository: Sylius/Sylius
Length of output: 488
🏁 Script executed:
# Search for return type patterns on container configurator closures across the repo
rg "return static function.*ContainerConfigurator.*\)" src --type php -B 1 -A 1 | head -40Repository: Sylius/Sylius
Length of output: 3124
🏁 Script executed:
# Check the actual file content to confirm it lacks both strict_types and return types
cat -n src/Sylius/Bundle/AdminBundle/Resources/config/services/twig.phpRepository: Sylius/Sylius
Length of output: 2273
🏁 Script executed:
# Search for ANY container configurator closures that DO have return types
rg "return static function.*ContainerConfigurator.*\)" src --type php | rg "void|: " | head -10Repository: Sylius/Sylius
Length of output: 39
Add declare(strict_types=1) and return type to the config closure.
Line 1 should declare strict types, and line 5 should include a : void 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.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| <?php | |
| namespace Symfony\Component\DependencyInjection\Loader\Configurator; | |
| return static function(ContainerConfigurator $container) { | |
| $services = $container->services(); | |
| <?php | |
| declare(strict_types=1); | |
| namespace Symfony\Component\DependencyInjection\Loader\Configurator; | |
| return static function (ContainerConfigurator $container): void { | |
| $services = $container->services(); |
🤖 Prompt for AI Agents
In `@src/Sylius/Bundle/AdminBundle/Resources/config/services/twig.php` around
lines 1 - 6, Add a strict types declaration and a void return type to the
service config closure: insert "declare(strict_types=1);" at the top of the PHP
file and change the anonymous function signature from "static
function(ContainerConfigurator $container)" to "static
function(ContainerConfigurator $container): void" so the closure has an explicit
return type; the change targets the closure that accepts ContainerConfigurator
($container) in this twig.php config file.
| $services->set('sylius_admin.twig.component.payment_method.form', 'Sylius\Bundle\UiBundle\Twig\Component\ResourceFormComponent') | ||
| ->args([ | ||
| service('sylius.repository.payment_method'), | ||
| service('form.factory'), | ||
| '%sylius.model.payment_method.class%', | ||
| 'Sylius\Bundle\AdminBundle\Form\Type\PaymentMethodType', | ||
| ]) | ||
| ->tag('sylius.twig_component', ['key' => 'sylius_admin:payment_method:form']); |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
cat -n src/Sylius/Bundle/AdminBundle/Resources/config/services/twig/component.phpRepository: Sylius/Sylius
Length of output: 11246
🏁 Script executed:
find . -name "*.xml" -type f | xargs grep -l "payment_method.*form" 2>/dev/null | head -20Repository: Sylius/Sylius
Length of output: 130
🏁 Script executed:
find ./src/Sylius/Bundle/AdminBundle -name "*.xml" -type f | xargs grep -l "component" 2>/dev/null | head -20Repository: Sylius/Sylius
Length of output: 39
🏁 Script executed:
ls -la ./src/Sylius/Bundle/AdminBundle/Resources/config/services/Repository: Sylius/Sylius
Length of output: 975
🏁 Script executed:
ls -la ./src/Sylius/Bundle/AdminBundle/Resources/config/services/twig/Repository: Sylius/Sylius
Length of output: 365
🏁 Script executed:
git log --oneline --follow -p -- src/Sylius/Bundle/AdminBundle/Resources/config/services/twig/component.php | head -200Repository: Sylius/Sylius
Length of output: 10455
🏁 Script executed:
git show 14c64ffdd6 --name-only | grep -i xmlRepository: Sylius/Sylius
Length of output: 50369
🏁 Script executed:
git show 14c64ffdd6 -- "src/Sylius/Bundle/AdminBundle/Resources/config/services/twig/component.xml" 2>/dev/null | head -100Repository: Sylius/Sylius
Length of output: 39
🏁 Script executed:
git log --all --full-history -- "src/Sylius/Bundle/AdminBundle/Resources/config/services/twig/component.xml" | head -20Repository: Sylius/Sylius
Length of output: 662
🏁 Script executed:
git show dda36b8d7f9bf9b813d3409ab2ef4b81d33db227:src/Sylius/Bundle/AdminBundle/Resources/config/services/twig/component.xml 2>/dev/null | grep -A 5 "payment_method"Repository: Sylius/Sylius
Length of output: 793
🏁 Script executed:
git show dda36b8d7f9bf9b813d3409ab2ef4b81d33db227:src/Sylius/Bundle/AdminBundle/Resources/config/services/twig/component.xml 2>/dev/null | grep -E "twig.component\.(admin_user|channel|currency)\.form" -A 8 | grep "tag name"Repository: Sylius/Sylius
Length of output: 321
Change payment_method.form tag to match other form components.
The payment_method.form service uses sylius.twig_component while all 17 other ResourceFormComponent services (admin_user, channel, currency, customer, etc.) use sylius.live_component.admin. This inconsistency existed in the original XML configuration and should be corrected to sylius.live_component.admin for consistency.
🤖 Prompt for AI Agents
In `@src/Sylius/Bundle/AdminBundle/Resources/config/services/twig/component.php`
around lines 89 - 96, The service
sylius_admin.twig.component.payment_method.form is tagged incorrectly: update
its tag from 'sylius.twig_component' to 'sylius.live_component.admin' so it
matches the other ResourceFormComponent services; locate the service definition
for sylius_admin.twig.component.payment_method.form (class
Sylius\Bundle\UiBundle\Twig\Component\ResourceFormComponent) and replace the
->tag('sylius.twig_component', ['key' => 'sylius_admin:payment_method:form'])
call with ->tag('sylius.live_component.admin', ['key' =>
'sylius_admin:payment_method:form']) ensuring the key stays the same.
| <?php | ||
|
|
||
| namespace Symfony\Component\DependencyInjection\Loader\Configurator; | ||
|
|
||
| return static function(ContainerConfigurator $container) { | ||
| $services = $container->services(); |
There was a problem hiding this comment.
Add strict_types and a void return type for the configurator closure.
This file should declare strict types and the closure should be explicitly typed to void.
🛠️ 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();As per coding guidelines: "Declare strict_types=1 at the beginning of all PHP files" and "Add type declarations for all properties, arguments, and return values in PHP code".
🤖 Prompt for AI Agents
In
`@src/Sylius/Bundle/AdminBundle/Resources/config/services/twig/component/promotion_coupon.php`
around lines 1 - 6, Add a strict types declaration at the top of the PHP file
and give the configurator closure an explicit void return type: insert
declare(strict_types=1); immediately after the opening <?php tag, and change the
anonymous function signature from "static function(ContainerConfigurator
$container)" to "static function(ContainerConfigurator $container): void" so the
closure is explicitly typed; keep the rest of the body and return value behavior
the same.
| <?php | ||
|
|
||
| namespace Symfony\Component\DependencyInjection\Loader\Configurator; | ||
|
|
||
| return static function(ContainerConfigurator $container) { | ||
| $services = $container->services(); |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
cat -n src/Sylius/Bundle/AdminBundle/Resources/config/services/twig/component/taxon.phpRepository: Sylius/Sylius
Length of output: 1684
Add strict types, void return type, and trailing commas in multi-line arrays.
This file is missing declare(strict_types=1); and the configurator closure lacks an explicit : void return type. Additionally, the multi-line argument lists (lines 14–20 and 24–28) are missing trailing commas.
🔧 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();
$services->set('sylius_admin.twig.component.taxon.delete', 'Sylius\Bundle\AdminBundle\Twig\Component\Taxon\DeleteComponent')
@@ -12,6 +14,7 @@ return static function(ContainerConfigurator $container) {
$services->set('sylius_admin.twig.component.taxon.form', 'Sylius\Bundle\AdminBundle\Twig\Component\Taxon\FormComponent')
->args([
service('sylius.repository.taxon'),
service('form.factory'),
'%sylius.model.taxon.class%',
'Sylius\Bundle\AdminBundle\Form\Type\TaxonType',
- service('sylius_admin.generator.taxon_slug'),
+ service('sylius_admin.generator.taxon_slug'),
])
->tag('sylius.live_component.admin', ['key' => 'sylius_admin:taxon:form']);
@@ -19,7 +22,7 @@ return static function(ContainerConfigurator $container) {
$services->set('sylius_admin.twig.component.taxon.tree', 'Sylius\Bundle\AdminBundle\Twig\Component\Taxon\TreeComponent')
->args([
service('sylius_admin.doctrine.query.taxon.all_taxons'),
service('sylius.repository.taxon'),
- service('sylius.manager.taxon'),
+ service('sylius.manager.taxon'),
])
->tag('sylius.live_component.admin', ['key' => 'sylius_admin:taxon:tree']);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", and "Use trailing commas in multi-line PHP arrays and argument lists".
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| <?php | |
| namespace Symfony\Component\DependencyInjection\Loader\Configurator; | |
| return static function(ContainerConfigurator $container) { | |
| $services = $container->services(); | |
| <?php | |
| declare(strict_types=1); | |
| namespace Symfony\Component\DependencyInjection\Loader\Configurator; | |
| return static function(ContainerConfigurator $container): void { | |
| $services = $container->services(); | |
| $services->set('sylius_admin.twig.component.taxon.delete', 'Sylius\Bundle\AdminBundle\Twig\Component\Taxon\DeleteComponent') | |
| ->tag('sylius.live_component.admin', ['key' => 'sylius_admin:taxon:delete']); | |
| $services->set('sylius_admin.twig.component.taxon.form', 'Sylius\Bundle\AdminBundle\Twig\Component\Taxon\FormComponent') | |
| ->args([ | |
| service('sylius.repository.taxon'), | |
| service('form.factory'), | |
| '%sylius.model.taxon.class%', | |
| 'Sylius\Bundle\AdminBundle\Form\Type\TaxonType', | |
| service('sylius_admin.generator.taxon_slug'), | |
| ]) | |
| ->tag('sylius.live_component.admin', ['key' => 'sylius_admin:taxon:form']); | |
| $services->set('sylius_admin.twig.component.taxon.tree', 'Sylius\Bundle\AdminBundle\Twig\Component\Taxon\TreeComponent') | |
| ->args([ | |
| service('sylius_admin.doctrine.query.taxon.all_taxons'), | |
| service('sylius.repository.taxon'), | |
| service('sylius.manager.taxon'), | |
| ]) | |
| ->tag('sylius.live_component.admin', ['key' => 'sylius_admin:taxon:tree']); | |
| }; |
🤖 Prompt for AI Agents
In
`@src/Sylius/Bundle/AdminBundle/Resources/config/services/twig/component/taxon.php`
around lines 1 - 6, Add a file-level declare(strict_types=1); and change the
configurator closure signature return type from implicit to explicit void by
updating the returned function signature (return static
function(ContainerConfigurator $container): void { ... });, and update the
multi-line argument/array lists used in the service definitions (the multi-line
argument lists in the configurator where services are defined) to include
trailing commas on each line of those multi-line arrays/argument lists; ensure
no other behavior changes.
| <?php | ||
|
|
||
| namespace Symfony\Component\DependencyInjection\Loader\Configurator; | ||
|
|
||
| return static function(ContainerConfigurator $container) { | ||
| $services = $container->services(); |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# First, let's read the actual file to see its current state
cat -n "src/Sylius/Bundle/AdminBundle/Resources/config/services/twig/component/zone.php"Repository: Sylius/Sylius
Length of output: 767
🏁 Script executed:
# Now let's find similar Symfony DI config files to see what pattern they follow
fd -e php "services.*\.php$" src/Sylius/Bundle/AdminBundle/Resources/config/ | head -20Repository: Sylius/Sylius
Length of output: 116
🏁 Script executed:
# Let's check a few of these similar files to see if they have strict_types and return types
for file in $(fd -e php "services.*\.php$" src/Sylius/Bundle/AdminBundle/Resources/config/ | head -5); do
echo "=== $file ==="
head -15 "$file"
echo ""
doneRepository: Sylius/Sylius
Length of output: 770
🏁 Script executed:
# Let's check if ANY Symfony DI config files in the codebase have strict_types declarations
rg -t php "^declare\(strict_types=1\);" src/Sylius/Bundle/AdminBundle/Resources/config/ | head -20Repository: Sylius/Sylius
Length of output: 39
🏁 Script executed:
# Let's get a broader view - check ALL PHP files in the config directory and count those with/without strict_types
echo "=== Config files WITHOUT strict_types ==="
fd -e php src/Sylius/Bundle/AdminBundle/Resources/config/ | while read file; do
if ! grep -q "^declare(strict_types=1);" "$file" 2>/dev/null; then
echo "$file"
fi
done | wc -l
echo "=== Config files WITH strict_types ==="
fd -e php src/Sylius/Bundle/AdminBundle/Resources/config/ | while read file; do
if grep -q "^declare(strict_types=1);" "$file" 2>/dev/null; then
echo "$file"
fi
done | wc -lRepository: Sylius/Sylius
Length of output: 1146
🏁 Script executed:
# Let's check if the main services.php file (entry point) has these declarations and return type
head -10 src/Sylius/Bundle/AdminBundle/Resources/config/services.php
tail -5 src/Sylius/Bundle/AdminBundle/Resources/config/services.phpRepository: Sylius/Sylius
Length of output: 625
🏁 Script executed:
# Check other bundle config files to see if there's a pattern across the repository
fd -e php "Resources/config/services\.php$" src/Sylius/Bundle/ | head -10 | xargs -I {} sh -c 'echo "=== {} ===" && head -7 {} | tail -4'Repository: Sylius/Sylius
Length of output: 39
🏁 Script executed:
# Correct fd command to search in the config directory
fd . src/Sylius/Bundle/AdminBundle/Resources/config/ -e php | while read file; do
if grep -q "^declare(strict_types=1);" "$file" 2>/dev/null; then
echo "WITH strict_types: $file"
fi
doneRepository: Sylius/Sylius
Length of output: 39
🏁 Script executed:
# Check a broader sample across different bundles to see if this is a systematic gap
echo "=== Checking 10 random services.php files across bundles ==="
fd -e php "Resources/config/services.php$" src/Sylius/Bundle/ | head -10 | while read file; do
if grep -q "^declare(strict_types=1);" "$file" 2>/dev/null; then
echo "HAS strict_types: $file"
else
echo "NO strict_types: $file"
fi
doneRepository: Sylius/Sylius
Length of output: 117
🏁 Script executed:
# Check if there are ANY PHP files in the repository that are Symfony DI config files WITH strict_types and return type
# Let's look at a few more recent or non-config files to understand the pattern
echo "=== Checking regular class files for strict_types ==="
fd -e php src/Sylius/Bundle/AdminBundle/Form/ | head -5 | while read file; do
echo "=== $file ==="
head -10 "$file" | grep -E "^(declare|class|function)" || head -10 "$file"
doneRepository: Sylius/Sylius
Length of output: 573
🏁 Script executed:
# Use rg to search the entire repo for declare(strict_types=1)
echo "=== Total PHP files with declare(strict_types=1) ==="
rg "^declare\(strict_types=1\);" --type php | wc -l
echo "=== Sample files WITH strict_types ==="
rg "^declare\(strict_types=1\);" --type php | head -10Repository: Sylius/Sylius
Length of output: 926
🏁 Script executed:
# Check total PHP files in src directory
echo "=== Total PHP files in src/Sylius ==="
find src/Sylius -name "*.php" | wc -l
# Check specifically in config directories
echo "=== PHP files in config directories ==="
find src/Sylius -path "*/Resources/config/*.php" | wc -lRepository: Sylius/Sylius
Length of output: 143
🏁 Script executed:
# Check if the non-config files have strict_types
echo "=== Sample non-config files ==="
find src/Sylius/Bundle/AdminBundle -name "*.php" ! -path "*/Resources/config/*" | head -5 | while read file; do
has_strict=$(grep -c "^declare(strict_types=1);" "$file" 2>/dev/null || echo 0)
echo "$file: strict_types=$has_strict"
doneRepository: Sylius/Sylius
Length of output: 538
🏁 Script executed:
# Let's also check what the actual return type would be
# Look at ContainerConfigurator to understand the expected closure signature
rg "ContainerConfigurator" --type php src/Sylius/Bundle/AdminBundle/Resources/config/ -A 3 | head -30Repository: Sylius/Sylius
Length of output: 3262
🏁 Script executed:
# Check if there's any documentation or comments about config files in the guidelines
rg -i "config|configurator" --type md . | grep -i "strict_types\|type.*declaration\|exception" | head -10Repository: Sylius/Sylius
Length of output: 39
🏁 Script executed:
# Check if any RECENT commits added strict_types to config files (indicating a recent push to standardize)
git log --all --oneline --grep="strict_types" 2>/dev/null | head -5 || echo "Git history not available"Repository: Sylius/Sylius
Length of output: 457
🏁 Script executed:
# Let's verify the actual return type that would be correct for the closure
# by checking Symfony documentation or type hints in the framework
rg "function.*ContainerConfigurator.*{" --type php -A 1 | head -20Repository: Sylius/Sylius
Length of output: 188
Add declare(strict_types=1) and return type to config closure.
Line 1 should declare strict types, and line 5 should include a : void return type and space before the parameter list.
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: all PHP files must declare strict_types=1 and include type declarations for all arguments and return values.
🤖 Prompt for AI Agents
In
`@src/Sylius/Bundle/AdminBundle/Resources/config/services/twig/component/zone.php`
around lines 1 - 6, Add the strict types declaration and a void return type for
the configuration closure: insert declare(strict_types=1); immediately after the
opening <?php, and change the returned closure signature from "return static
function(ContainerConfigurator $container) {" to "return static function
(ContainerConfigurator $container): void {" (note the space before the parameter
list and the : void return type), targeting the closure that accepts
ContainerConfigurator $container.
| <?php | ||
|
|
||
| namespace Symfony\Component\DependencyInjection\Loader\Configurator; | ||
|
|
||
| return static function(ContainerConfigurator $container) { | ||
| $services = $container->services(); |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
cat -n src/Sylius/Bundle/AdminBundle/Resources/config/services/twig/error_template_finder.phpRepository: Sylius/Sylius
Length of output: 711
🏁 Script executed:
# Find similar configuration files in the codebase
fd -e php -path "*/config/services/*" | head -20Repository: Sylius/Sylius
Length of output: 225
🏁 Script executed:
# Check if similar Symfony config files have strict_types declaration
rg -t php "declare\(strict_types" --files-with-matches -A2 | grep "config/services" | head -10Repository: Sylius/Sylius
Length of output: 806
🏁 Script executed:
# Check a few similar config files
head -6 src/Sylius/Bundle/PromotionBundle/Resources/config/services.phpRepository: Sylius/Sylius
Length of output: 138
🏁 Script executed:
head -6 src/Sylius/Bundle/PromotionBundle/Resources/config/services/forms.phpRepository: Sylius/Sylius
Length of output: 138
🏁 Script executed:
head -6 src/Sylius/Bundle/ShippingBundle/Resources/config/services/form.phpRepository: Sylius/Sylius
Length of output: 138
🏁 Script executed:
# Search across all config service files for strict_types
rg "declare\(strict_types" src/Sylius/Bundle --glob="*/config/services/**/*.php" -lRepository: Sylius/Sylius
Length of output: 39
🏁 Script executed:
# Verify the scope of the coding guidelines - check if **/*.php truly means all files
rg "declare\(strict_types" src/Sylius/Bundle --glob="**/*.php" | head -5Repository: Sylius/Sylius
Length of output: 501
🏁 Script executed:
# Count how many PHP files in total vs how many have strict_types
echo "=== Total PHP files in src/Sylius/Bundle ==="
fd -e php src/Sylius/Bundle | wc -l
echo ""
echo "=== PHP files with strict_types in src/Sylius/Bundle ==="
rg "declare\(strict_types" src/Sylius/Bundle -l | wc -lRepository: Sylius/Sylius
Length of output: 557
🏁 Script executed:
# Correct syntax to count PHP files in src/Sylius/Bundle
fd . 'src/Sylius/Bundle' -e php | wc -lRepository: Sylius/Sylius
Length of output: 61
🏁 Script executed:
# Count PHP files with strict_types in src/Sylius/Bundle
rg "declare\(strict_types" 'src/Sylius/Bundle' -l | wc -lRepository: Sylius/Sylius
Length of output: 61
🏁 Script executed:
# Check specifically config files again
fd . 'src/Sylius/Bundle' -e php -path "*/config/services/*" | wc -lRepository: Sylius/Sylius
Length of output: 244
🏁 Script executed:
# Check if ANY config service files have strict_types
rg "declare\(strict_types" 'src/Sylius/Bundle' -l | grep "config/services"Repository: Sylius/Sylius
Length of output: 6605
🏁 Script executed:
# Verify the closure return type pattern - check a sample of config files
head -10 src/Sylius/Bundle/UiBundle/Resources/config/services/twig.phpRepository: Sylius/Sylius
Length of output: 272
🏁 Script executed:
# Check if any config closure has a return type
rg "return static function" 'src/Sylius/Bundle' --glob="*/config/services/**/*.php" -A1 | head -20Repository: Sylius/Sylius
Length of output: 39
🏁 Script executed:
# Check if ANY config service file has a return type on the closure
rg "return static function.*:" 'src/Sylius/Bundle' --glob="*/config/services/**/*.php"Repository: Sylius/Sylius
Length of output: 39
🏁 Script executed:
# Sample the closure signatures from multiple config files
rg "return static function" 'src/Sylius/Bundle' --glob="*/config/services/**/*.php" -A 0 | head -10Repository: Sylius/Sylius
Length of output: 39
🏁 Script executed:
# Get actual closure signatures from config service files
rg "return static function\(" 'src/Sylius/Bundle' --glob="*/config/services/**/*.php" -A 0 | head -10Repository: Sylius/Sylius
Length of output: 39
🏁 Script executed:
# Check if this file specifically has all the violations mentioned
cat src/Sylius/Bundle/AdminBundle/Resources/config/services/twig/error_template_finder.php | head -10Repository: Sylius/Sylius
Length of output: 444
Add declare(strict_types=1) and return type for the config closure.
Line 1 should declare strict types, and the closure on line 5 should include : void 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: All PHP files must declare strict_types=1 at the beginning, and all properties, arguments, and return values must have type declarations.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| <?php | |
| namespace Symfony\Component\DependencyInjection\Loader\Configurator; | |
| return static function(ContainerConfigurator $container) { | |
| $services = $container->services(); | |
| <?php | |
| declare(strict_types=1); | |
| namespace Symfony\Component\DependencyInjection\Loader\Configurator; | |
| return static function (ContainerConfigurator $container): void { | |
| $services = $container->services(); |
🤖 Prompt for AI Agents
In
`@src/Sylius/Bundle/AdminBundle/Resources/config/services/twig/error_template_finder.php`
around lines 1 - 6, Add a strict types declaration at the top of the PHP file
and give the returned closure an explicit void return type: insert
declare(strict_types=1); as the first statement and change the returned static
function signature (the closure that accepts ContainerConfigurator $container)
to include : void so it becomes static function(ContainerConfigurator
$container): void { ... }.
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@src/Sylius/Bundle/AdminBundle/Resources/config/services.php`:
- Around line 34-36: The services twig component files are not loaded because
the existing $container->import('services/twig/*.php') glob does not recurse
into subdirectories; add an explicit import call to import the nested component
files by adding another $container->import call for the twig component pattern
(e.g., import the 'services/twig/component/*.php' glob) next to the other
imports so the component/*.php service definitions are registered; update the
import list where $container->import('services/*.php'),
$container->import('services/product/*.php'), and
$container->import('services/twig/*.php') are declared.
In
`@src/Sylius/Bundle/AdminBundle/Resources/config/services/twig/component/product.php`:
- Line 21: The closure signature "static function (ContainerConfigurator
$container)" in the service config is missing a return type; update that
anonymous function to include the void return type so it reads "static function
(ContainerConfigurator $container): void" to match other config files and coding
guidelines.
🧹 Nitpick comments (2)
src/Sylius/Bundle/AdminBundle/Resources/config/services.php (2)
80-80: Consider using FQCN import +::classfor the alias target.Line 80 uses a raw string
'Psr\Http\Client\ClientInterface'instead of importing the class and usingClientInterface::class. While functionally equivalent, using::classreferences is more consistent with the rest of this file and provides IDE navigation and static analysis benefits.♻️ Suggested change
Add to the imports:
use Psr\Http\Client\ClientInterface;Then update the alias:
- $services->alias('sylius.http_client', 'Psr\Http\Client\ClientInterface'); + $services->alias('sylius.http_client', ClientInterface::class);
80-80: Consider using::classconstant instead of a raw string for the alias target.Line 80 uses
'Psr\Http\Client\ClientInterface'as a raw string, while all other class references in this file use imported::classconstants. Using::classis more consistent and provides IDE navigation and static analysis benefits.♻️ Suggested change
Add to the imports:
use Psr\Http\Client\ClientInterface;- $services->alias('sylius.http_client', 'Psr\Http\Client\ClientInterface'); + $services->alias('sylius.http_client', ClientInterface::class);
| $container->import('services/*.php'); | ||
| $container->import('services/product/*.php'); | ||
| $container->import('services/twig/*.php'); |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
echo "=== All PHP files under services/twig/ ==="
find src/Sylius/Bundle/AdminBundle/Resources/config/services/twig/ -name '*.php' -type f 2>/dev/null | sort
echo ""
echo "=== PHP files directly in services/twig/ (depth 1 only) ==="
find src/Sylius/Bundle/AdminBundle/Resources/config/services/twig/ -maxdepth 1 -name '*.php' -type f 2>/dev/null | sort
echo ""
echo "=== Content of any PHP files directly in services/twig/ to check for re-imports ==="
find src/Sylius/Bundle/AdminBundle/Resources/config/services/twig/ -maxdepth 1 -name '*.php' -type f -exec cat -n {} + 2>/dev/null
echo ""
echo "=== Check services.php imports for complete picture ==="
grep -n "import" src/Sylius/Bundle/AdminBundle/Resources/config/services.phpRepository: Sylius/Sylius
Length of output: 14600
Add explicit import for services/twig/component/*.php subdirectory.
Symfony's ContainerConfigurator::import() with *.php glob matches only files at the specified depth and does not recurse into subdirectories. The glob pattern services/twig/*.php matches the barrel file component.php, but that file does not re-import the nested component/ subdirectory. As a result, all service definitions in services/twig/component/*.php (dashboard.php, customer.php, etc.) are never loaded.
Add $container->import('services/twig/component/*.php'); to lines 34-36 to ensure nested component services are registered.
🤖 Prompt for AI Agents
In `@src/Sylius/Bundle/AdminBundle/Resources/config/services.php` around lines 34
- 36, The services twig component files are not loaded because the existing
$container->import('services/twig/*.php') glob does not recurse into
subdirectories; add an explicit import call to import the nested component files
by adding another $container->import call for the twig component pattern (e.g.,
import the 'services/twig/component/*.php' glob) next to the other imports so
the component/*.php service definitions are registered; update the import list
where $container->import('services/*.php'),
$container->import('services/product/*.php'), and
$container->import('services/twig/*.php') are declared.
| use Sylius\Bundle\AdminBundle\Twig\Component\Product\FormComponent; | ||
| use Sylius\Bundle\AdminBundle\Twig\Component\Product\ProductAttributeAutocompleteComponent; | ||
|
|
||
| return static function (ContainerConfigurator $container) { |
There was a problem hiding this comment.
🛠️ Refactor suggestion | 🟠 Major
Add : void return type to the closure.
Same pattern as the other config files — the closure is missing its : void return type.
-return static function (ContainerConfigurator $container) {
+return static function (ContainerConfigurator $container): void {As per coding guidelines: "Add type declarations for all properties, arguments, and return values in PHP code."
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| return static function (ContainerConfigurator $container) { | |
| return static function (ContainerConfigurator $container): void { |
🤖 Prompt for AI Agents
In
`@src/Sylius/Bundle/AdminBundle/Resources/config/services/twig/component/product.php`
at line 21, The closure signature "static function (ContainerConfigurator
$container)" in the service config is missing a return type; update that
anonymous function to include the void return type so it reads "static function
(ContainerConfigurator $container): void" to match other config files and coding
guidelines.
Summary by CodeRabbit
Chores
New Features