Conversation
📝 WalkthroughWalkthroughReplaces XML-based Dependency Injection configuration for PromotionBundle with PHP ContainerConfigurator files: swaps XmlFileLoader → PhpFileLoader in the bundle extension, adds PHP service configurators under Resources/config (services, forms, validators, criteria, eligibility_checkers, integrations, console_command), removes corresponding XML files, and updates composer-require-checker whitelist. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 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:
|
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Fix all issues with AI agents
In `@src/Sylius/Bundle/PromotionBundle/Resources/config/services.php`:
- Around line 80-84: The ActivePromotionsProvider service is registered but not
aliased to the PreQualifiedPromotionsProviderInterface, which breaks autowiring;
add an alias from PreQualifiedPromotionsProviderInterface to the existing
service id 'sylius.provider.active_promotions' so code type-hinting
PreQualifiedPromotionsProviderInterface resolves to ActivePromotionsProvider
(i.e., create an alias for PreQualifiedPromotionsProviderInterface::class
pointing at 'sylius.provider.active_promotions' alongside the existing
ActivePromotionsProvider alias).
In
`@src/Sylius/Bundle/PromotionBundle/Resources/config/services/eligibility_checkers.php`:
- Around line 40-42: The closure static function (ContainerConfigurator
$container) defined in the services config should declare an explicit return
type to comply with project guidelines; change its signature to include : void
(i.e. static function (ContainerConfigurator $container): void) so the function
has an explicit return type while leaving the rest of the closure body
unchanged; this affects the closure used to register services such as
CompositePromotionCouponEligibilityChecker and
CompositePromotionEligibilityChecker.
In `@src/Sylius/Bundle/PromotionBundle/Resources/config/services/forms.php`:
- Around line 37-44: Add a new validation-groups parameter named
sylius.form.type.promotion_rule.validation_groups (value ['sylius']) alongside
the other form validation parameters, and update the PromotionRuleType service
configuration to reference this new parameter instead of
sylius.form.type.promotion_scope.validation_groups; locate the parameter block
in forms.php where other sylius.form.type.*.validation_groups are set and the
PromotionRuleType service/config entry (the service or class named
PromotionRuleType) to swap the validation_groups reference to the new
sylius.form.type.promotion_rule.validation_groups symbol.
🧹 Nitpick comments (6)
src/Sylius/Bundle/PromotionBundle/Resources/config/services/integrations/doctrine/orm.php (1)
20-20: Add explicit: voidreturn type to the config closure.
Keeps return typing consistent with the PHP guidelines.Proposed change
-return static function (ContainerConfigurator $container) { +return static function (ContainerConfigurator $container): void {src/Sylius/Bundle/PromotionBundle/Resources/config/services/criteria.php (1)
19-19: Add explicit: voidreturn type to the config closure.
Keeps return typing consistent with the PHP guidelines.Proposed change
-return static function (ContainerConfigurator $container) { +return static function (ContainerConfigurator $container): void {src/Sylius/Bundle/PromotionBundle/Resources/config/services/console_command.php (1)
18-18: Add explicit: voidreturn type to the config closure.
Keeps return typing consistent with the PHP guidelines.Proposed change
-return static function (ContainerConfigurator $container) { +return static function (ContainerConfigurator $container): void {src/Sylius/Bundle/PromotionBundle/Resources/config/services/validators.php (1)
29-29: Add explicit: voidreturn type to the config closure.
Keeps return typing consistent with the PHP guidelines.Proposed change
-return static function (ContainerConfigurator $container) { +return static function (ContainerConfigurator $container): void {src/Sylius/Bundle/PromotionBundle/Resources/config/services/eligibility_checkers.php (1)
28-28: Add explicit: voidreturn type to the config closure.
Keeps return typing consistent with the PHP guidelines.Proposed change
-return static function (ContainerConfigurator $container) { +return static function (ContainerConfigurator $container): void {src/Sylius/Bundle/PromotionBundle/Resources/config/services.php (1)
35-35: Add explicit: voidreturn type to the config closure.
Keeps return typing consistent with the PHP guidelines.Proposed change
-return static function (ContainerConfigurator $container) { +return static function (ContainerConfigurator $container): void {
| $services->set('sylius.provider.active_promotions', ActivePromotionsProvider::class) | ||
| ->args([service('sylius.repository.promotion')]); | ||
|
|
||
| $services->alias(ActivePromotionsProvider::class, 'sylius.provider.active_promotions'); | ||
|
|
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# Check for interface definition
rg -n -C2 "interface ActivePromotionsProviderInterface" --glob '*.php'Repository: Sylius/Sylius
Length of output: 39
🏁 Script executed:
# Check for interface usage
rg -n "ActivePromotionsProviderInterface" --glob '*.php'Repository: Sylius/Sylius
Length of output: 386
🏁 Script executed:
# Read the services.php file around line 35 to check the return type
head -50 src/Sylius/Bundle/PromotionBundle/Resources/config/services.php | tail -20Repository: Sylius/Sylius
Length of output: 1103
🏁 Script executed:
# Get more context from the beginning of the services.php file
head -40 src/Sylius/Bundle/PromotionBundle/Resources/config/services.phpRepository: Sylius/Sylius
Length of output: 1909
🏁 Script executed:
# Search for the interface definition in the entire codebase
fd -e php -x grep -l "class.*ActivePromotionsProviderInterface\|interface.*ActivePromotionsProviderInterface" {} \;Repository: Sylius/Sylius
Length of output: 39
🏁 Script executed:
# Look for the interface in the Component/Promotion package specifically
rg "ActivePromotionsProviderInterface" --glob '*.php' -B2 -A2Repository: Sylius/Sylius
Length of output: 1254
🏁 Script executed:
# Check if there's a provider directory in Component/Promotion with the interface
fd -e php . | grep -i "promotion.*provider" | head -20Repository: Sylius/Sylius
Length of output: 997
🏁 Script executed:
# Check what interface ActivePromotionsProvider actually implements
cat src/Sylius/Component/Promotion/Provider/ActivePromotionsProvider.phpRepository: Sylius/Sylius
Length of output: 826
🏁 Script executed:
# Also check PreQualifiedPromotionsProviderInterface to understand the hierarchy
cat src/Sylius/Component/Promotion/Provider/PreQualifiedPromotionsProviderInterface.phpRepository: Sylius/Sylius
Length of output: 653
🏁 Script executed:
# Check the full services.php file around lines 80-84 to see the current configuration
sed -n '75,90p' src/Sylius/Bundle/PromotionBundle/Resources/config/services.phpRepository: Sylius/Sylius
Length of output: 725
🏁 Script executed:
# Check if PreQualifiedPromotionsProviderInterface is already aliased anywhere
rg "PreQualifiedPromotionsProviderInterface" --glob '*.php' -B2 -A2 | head -40Repository: Sylius/Sylius
Length of output: 4335
🏁 Script executed:
# Check the entire services.php to see all aliases and imports
rg "alias.*Promotions" src/Sylius/Bundle/PromotionBundle/Resources/config/services.php -B2 -A2Repository: Sylius/Sylius
Length of output: 455
Add alias for PreQualifiedPromotionsProviderInterface.
The service only registers the concrete class. Since PreQualifiedPromotionsProviderInterface is the actual interface implemented by ActivePromotionsProvider and is type-hinted in production code, add an interface alias to maintain autowiring consistency with the pattern used elsewhere in this file.
Required change
use Sylius\Component\Promotion\Provider\ActivePromotionsProvider;
+use Sylius\Component\Promotion\Provider\PreQualifiedPromotionsProviderInterface;
$services->alias(ActivePromotionsProvider::class, 'sylius.provider.active_promotions');
+ $services->alias(PreQualifiedPromotionsProviderInterface::class, 'sylius.provider.active_promotions');🤖 Prompt for AI Agents
In `@src/Sylius/Bundle/PromotionBundle/Resources/config/services.php` around lines
80 - 84, The ActivePromotionsProvider service is registered but not aliased to
the PreQualifiedPromotionsProviderInterface, which breaks autowiring; add an
alias from PreQualifiedPromotionsProviderInterface to the existing service id
'sylius.provider.active_promotions' so code type-hinting
PreQualifiedPromotionsProviderInterface resolves to ActivePromotionsProvider
(i.e., create an alias for PreQualifiedPromotionsProviderInterface::class
pointing at 'sylius.provider.active_promotions' alongside the existing
ActivePromotionsProvider alias).
| $services->set('sylius.checker.promotion_coupon_eligibility', CompositePromotionCouponEligibilityChecker::class) | ||
| ->args([[]]); | ||
|
|
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
cat -n src/Sylius/Bundle/PromotionBundle/Resources/config/services/eligibility_checkers.phpRepository: Sylius/Sylius
Length of output: 4292
🏁 Script executed:
rg -n "CompositePromotion(Coupon)?EligibilityChecker" --glob="*.php" -A 10 -B 2 | head -80Repository: Sylius/Sylius
Length of output: 11108
🏁 Script executed:
rg -n "eligibility_checker.*tag" --glob="*.php"Repository: Sylius/Sylius
Length of output: 836
🏁 Script executed:
fd "CompilerPass" --glob="*.php" | xargs grep -l "eligibility_checker" 2>/dev/nullRepository: Sylius/Sylius
Length of output: 221
🏁 Script executed:
fd "CompositePromotionEligibilityCheckerPass.php" --type fRepository: Sylius/Sylius
Length of output: 164
🏁 Script executed:
fd "CompositePromotionCouponEligibilityCheckerPass.php" --type fRepository: Sylius/Sylius
Length of output: 170
🏁 Script executed:
cat -n src/Sylius/Bundle/PromotionBundle/DependencyInjection/Compiler/CompositePromotionEligibilityCheckerPass.phpRepository: Sylius/Sylius
Length of output: 1361
🏁 Script executed:
cat -n src/Sylius/Bundle/PromotionBundle/DependencyInjection/Compiler/CompositePromotionCouponEligibilityCheckerPass.phpRepository: Sylius/Sylius
Length of output: 1388
🏁 Script executed:
cat -n src/Sylius/Bundle/PromotionBundle/Resources/config/services/eligibility_checkers.php | sed -n '28p'Repository: Sylius/Sylius
Length of output: 123
Add return type declaration : void to the closure on line 28.
The closure static function (ContainerConfigurator $container) is missing an explicit return type. It should be static function (ContainerConfigurator $container): void to comply with the guideline requiring type declarations for all return values.
Note: The empty arrays in the composite eligibility checkers (lines 40-42, 65-66) are intentional placeholders. They are properly populated at compile time via CompositePromotionEligibilityCheckerPass and CompositePromotionCouponEligibilityCheckerPass compiler passes, which collect all tagged services and wire them correctly.
🤖 Prompt for AI Agents
In
`@src/Sylius/Bundle/PromotionBundle/Resources/config/services/eligibility_checkers.php`
around lines 40 - 42, The closure static function (ContainerConfigurator
$container) defined in the services config should declare an explicit return
type to comply with project guidelines; change its signature to include : void
(i.e. static function (ContainerConfigurator $container): void) so the function
has an explicit return type while leaving the rest of the closure body
unchanged; this affects the closure used to register services such as
CompositePromotionCouponEligibilityChecker and
CompositePromotionEligibilityChecker.
| $parameters->set('sylius.form.type.catalog_promotion.validation_groups', ['sylius']); | ||
| $parameters->set('sylius.form.type.catalog_promotion_translation.validation_groups', ['sylius']); | ||
| $parameters->set('sylius.form.type.promotion.validation_groups', ['sylius']); | ||
| $parameters->set('sylius.form.type.promotion_translation.validation_groups', ['sylius']); | ||
| $parameters->set('sylius.form.type.promotion_action.validation_groups', ['sylius']); | ||
| $parameters->set('sylius.form.type.promotion_scope.validation_groups', ['sylius']); | ||
| $parameters->set('sylius.form.type.promotion_coupon.validation_groups', ['sylius']); | ||
| $parameters->set('sylius.form.type.promotion_coupon_generator_instruction.validation_groups', ['sylius']); |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# First, let's examine the file and see the full context
cat -n src/Sylius/Bundle/PromotionBundle/Resources/config/services/forms.php | head -120Repository: Sylius/Sylius
Length of output: 6551
🏁 Script executed:
# Search for PromotionRuleType in the codebase
rg -n "PromotionRuleType" src/Sylius/Bundle/PromotionBundle -g '*.php' -A 5 -B 2Repository: Sylius/Sylius
Length of output: 18312
🏁 Script executed:
# Search for validation groups references to promotion_scope and promotion_rule
rg -n "sylius\.form\.type\.promotion_(scope|rule)\.validation_groups" src/Sylius/Bundle -g '*.php' -g '*.xml' -A 2 -B 2Repository: Sylius/Sylius
Length of output: 1480
Add missing promotion_rule validation group parameter and update PromotionRuleType to use it.
PromotionRuleType at line 100-106 incorrectly uses promotion_scope validation groups (line 103). Following the pattern established by other form types (catalog_promotion, promotion, promotion_action, etc.), add a dedicated sylius.form.type.promotion_rule.validation_groups parameter at line 42 and update the service configuration to use it.
Fix
$parameters->set('sylius.form.type.promotion_action.validation_groups', ['sylius']);
+$parameters->set('sylius.form.type.promotion_rule.validation_groups', ['sylius']);
$parameters->set('sylius.form.type.promotion_scope.validation_groups', ['sylius']);And at lines 100-105:
$services->set('sylius.form.type.promotion_rule', PromotionRuleType::class)
->args([
'%sylius.model.promotion_rule.class%',
- '%sylius.form.type.promotion_scope.validation_groups%',
+ '%sylius.form.type.promotion_rule.validation_groups%',
service('sylius.form_registry.promotion_rule_checker'),
])🤖 Prompt for AI Agents
In `@src/Sylius/Bundle/PromotionBundle/Resources/config/services/forms.php` around
lines 37 - 44, Add a new validation-groups parameter named
sylius.form.type.promotion_rule.validation_groups (value ['sylius']) alongside
the other form validation parameters, and update the PromotionRuleType service
configuration to reference this new parameter instead of
sylius.form.type.promotion_scope.validation_groups; locate the parameter block
in forms.php where other sylius.form.type.*.validation_groups are set and the
PromotionRuleType service/config entry (the service or class named
PromotionRuleType) to swap the validation_groups reference to the new
sylius.form.type.promotion_rule.validation_groups symbol.
3d8a802 to
8889109
Compare
| $parameters = $container->parameters(); | ||
|
|
||
| $services->defaults() | ||
| ->public(); |
There was a problem hiding this comment.
| $parameters = $container->parameters(); | |
| $services->defaults() | |
| ->public(); |
| ->args([ | ||
| service('sylius.repository.promotion'), | ||
| service('sylius.generator.promotion_coupon'), | ||
| ]) |
There was a problem hiding this comment.
| ]) | |
| ]) | |
| ->public() |
|
|
||
| return static function (ContainerConfigurator $container) { | ||
| $services = $container->services(); | ||
| $parameters = $container->parameters(); |
There was a problem hiding this comment.
| $parameters = $container->parameters(); |
|
|
||
| return static function (ContainerConfigurator $container) { | ||
| $services = $container->services(); | ||
| $parameters = $container->parameters(); |
There was a problem hiding this comment.
| $parameters = $container->parameters(); |
|
|
||
| return static function (ContainerConfigurator $container) { | ||
| $services = $container->services(); | ||
| $parameters = $container->parameters(); |
There was a problem hiding this comment.
| $parameters = $container->parameters(); |
| $services = $container->services(); | ||
| $parameters = $container->parameters(); | ||
| $container->import('services/*.php'); |
There was a problem hiding this comment.
| $services = $container->services(); | |
| $parameters = $container->parameters(); | |
| $container->import('services/*.php'); | |
| $container->import('services/*.php'); | |
| $services = $container->services(); |
b0b630d to
051adcf
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@src/Sylius/Bundle/PromotionBundle/Resources/config/services/forms.php`:
- Line 34: The exported config closure in services.php currently lacks an
explicit return type; update the anonymous static function signature "static
function (ContainerConfigurator $container)" to declare a void return type
(i.e., "static function (ContainerConfigurator $container): void") so it
conforms to the return-type coding guideline; ensure only the signature is
changed and the function body and ContainerConfigurator usage remain untouched.
In `@src/Sylius/Bundle/PromotionBundle/Resources/config/services/validators.php`:
- Around line 67-73: The service IDs are misspelled as "promotion_role_group"
and "promotion_role_type"; update them to "promotion_rule_group" and
"promotion_rule_type" to match the validator classes PromotionRuleGroupValidator
and PromotionRuleTypeValidator and the constraint aliases
sylius_promotion_rule_group / sylius_promotion_rule_type, and then search for
any other references to the old service IDs to update them accordingly so
configuration and usage remain consistent.
🧹 Nitpick comments (3)
src/Sylius/Bundle/PromotionBundle/Resources/config/services/console_command.php (1)
18-29: Add: voidreturn type to the closure.The closure is missing an explicit return type declaration. Per coding guidelines, all return values should have type declarations.
Suggested fix
-return static function (ContainerConfigurator $container) { +return static function (ContainerConfigurator $container): void { $services = $container->services();src/Sylius/Bundle/PromotionBundle/Resources/config/services/validators.php (1)
29-77: Add: voidreturn type to the closure.The closure is missing an explicit return type declaration. Per coding guidelines, all return values should have type declarations.
Suggested fix
-return static function (ContainerConfigurator $container) { +return static function (ContainerConfigurator $container): void { $services = $container->services();src/Sylius/Bundle/PromotionBundle/Resources/config/services.php (1)
35-108: Add: voidreturn type to the closure.The closure is missing an explicit return type declaration. Per coding guidelines, all return values should have type declarations.
Suggested fix
-return static function (ContainerConfigurator $container) { +return static function (ContainerConfigurator $container): void { $services = $container->services();
| use Sylius\Component\Promotion\Generator\PromotionCouponGeneratorInstruction; | ||
| use Symfony\Component\Form\Extension\Core\DataMapper\DataMapper; | ||
|
|
||
| return static function (ContainerConfigurator $container) { |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check how other service PHP configs declare the ContainerConfigurator closure
rg -n "return static function \(ContainerConfigurator" src/Sylius/Bundle -g '*.php' -C 2Repository: Sylius/Sylius
Length of output: 15898
Add an explicit void return type to the config closure.
The closure function should declare its return type in accordance with the coding guideline requiring type declarations for all return values.
Suggested change
-return static function (ContainerConfigurator $container) {
+return static function (ContainerConfigurator $container): void {📝 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/PromotionBundle/Resources/config/services/forms.php` at
line 34, The exported config closure in services.php currently lacks an explicit
return type; update the anonymous static function signature "static function
(ContainerConfigurator $container)" to declare a void return type (i.e., "static
function (ContainerConfigurator $container): void") so it conforms to the
return-type coding guideline; ensure only the signature is changed and the
function body and ContainerConfigurator usage remain untouched.
| $services->set('sylius.validator.promotion_role_group', PromotionRuleGroupValidator::class) | ||
| ->args(['%sylius.promotion.promotion_rule.validation_groups%']) | ||
| ->tag('validator.constraint_validator', ['alias' => 'sylius_promotion_rule_group']); | ||
|
|
||
| $services->set('sylius.validator.promotion_role_type', PromotionRuleTypeValidator::class) | ||
| ->args(['%sylius.promotion_rules%']) | ||
| ->tag('validator.constraint_validator', ['alias' => 'sylius_promotion_rule_type']); |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
rg -n "sylius\.validator\.promotion_r[ou][lu]e_(group|type)" --glob '*.php' --glob '*.xml' --glob '*.yaml' --glob '*.yml'Repository: Sylius/Sylius
Length of output: 402
🏁 Script executed:
# Also search for references to the aliases in the tags
rg -n "sylius_promotion_rule_(group|type)" --glob '*.php' --glob '*.xml' --glob '*.yaml' --glob '*.yml'Repository: Sylius/Sylius
Length of output: 651
🏁 Script executed:
# Find the validator class files to confirm the class names
fd -e php "PromotionRule(Group|Type)Validator"Repository: Sylius/Sylius
Length of output: 378
🏁 Script executed:
# Check the content around lines 67-73 in the actual file to see current state
sed -n '60,80p' src/Sylius/Bundle/PromotionBundle/Resources/config/services/validators.phpRepository: Sylius/Sylius
Length of output: 1179
Fix typo in service IDs: "role" should be "rule".
The service IDs use promotion_role_group and promotion_role_type, which is inconsistent with the validator class names (PromotionRuleGroupValidator, PromotionRuleTypeValidator) and the constraint aliases. Although the aliases are correct and ensure the validators work, the service ID naming should match the class names for consistency.
Suggested fix
- $services->set('sylius.validator.promotion_role_group', PromotionRuleGroupValidator::class)
+ $services->set('sylius.validator.promotion_rule_group', PromotionRuleGroupValidator::class)
->args(['%sylius.promotion.promotion_rule.validation_groups%'])
->tag('validator.constraint_validator', ['alias' => 'sylius_promotion_rule_group']);
- $services->set('sylius.validator.promotion_role_type', PromotionRuleTypeValidator::class)
+ $services->set('sylius.validator.promotion_rule_type', PromotionRuleTypeValidator::class)
->args(['%sylius.promotion_rules%'])
->tag('validator.constraint_validator', ['alias' => 'sylius_promotion_rule_type']);📝 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.
| $services->set('sylius.validator.promotion_role_group', PromotionRuleGroupValidator::class) | |
| ->args(['%sylius.promotion.promotion_rule.validation_groups%']) | |
| ->tag('validator.constraint_validator', ['alias' => 'sylius_promotion_rule_group']); | |
| $services->set('sylius.validator.promotion_role_type', PromotionRuleTypeValidator::class) | |
| ->args(['%sylius.promotion_rules%']) | |
| ->tag('validator.constraint_validator', ['alias' => 'sylius_promotion_rule_type']); | |
| $services->set('sylius.validator.promotion_rule_group', PromotionRuleGroupValidator::class) | |
| ->args(['%sylius.promotion.promotion_rule.validation_groups%']) | |
| ->tag('validator.constraint_validator', ['alias' => 'sylius_promotion_rule_group']); | |
| $services->set('sylius.validator.promotion_rule_type', PromotionRuleTypeValidator::class) | |
| ->args(['%sylius.promotion.promotion_rules%']) | |
| ->tag('validator.constraint_validator', ['alias' => 'sylius_promotion_rule_type']); |
🤖 Prompt for AI Agents
In `@src/Sylius/Bundle/PromotionBundle/Resources/config/services/validators.php`
around lines 67 - 73, The service IDs are misspelled as "promotion_role_group"
and "promotion_role_type"; update them to "promotion_rule_group" and
"promotion_rule_type" to match the validator classes PromotionRuleGroupValidator
and PromotionRuleTypeValidator and the constraint aliases
sylius_promotion_rule_group / sylius_promotion_rule_type, and then search for
any other references to the old service IDs to update them accordingly so
configuration and usage remain consistent.
051adcf to
420f012
Compare
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Fix all issues with AI agents
In `@src/Sylius/Bundle/PromotionBundle/Resources/config/services.php`:
- Around line 35-36: The closure returned by the file uses the signature "return
static function (ContainerConfigurator $container)" but lacks an explicit return
type; update the anonymous configurator function signature to declare a void
return type (i.e., add ": void") so it becomes "return static function
(ContainerConfigurator $container): void" to match coding guidelines and
indicate it does not return a value.
In `@src/Sylius/Bundle/PromotionBundle/Resources/config/services/criteria.php`:
- Around line 19-20: The returned static configurator closure should declare an
explicit void return type to satisfy coding guidelines; update the anonymous
function returned (the static function accepting ContainerConfigurator
$container) to have a ": void" return type so the signature becomes a static
function(ContainerConfigurator $container): void, keeping the
ContainerConfigurator parameter and body unchanged.
In `@src/Sylius/Bundle/PromotionBundle/Resources/config/services/validators.php`:
- Around line 29-30: Update the returned static closure to include an explicit
void return type: modify the anonymous function signature that currently reads
"return static function (ContainerConfigurator $container)" to "return static
function (ContainerConfigurator $container): void" so the closure conforms to
the project's type-declaration guidelines; ensure the change targets the closure
that assigns $services = $container->services() in validators.php.
| return static function (ContainerConfigurator $container) { | ||
| $services = $container->services(); |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# Check if the file exists and read the relevant section
fd -t f "services.php" --path "*/PromotionBundle/Resources/config/*"Repository: Sylius/Sylius
Length of output: 290
🏁 Script executed:
# Read the file to see lines around 35-36
cat -n src/Sylius/Bundle/PromotionBundle/Resources/config/services.php | head -50Repository: Sylius/Sylius
Length of output: 2816
Add explicit : void return type to the configurator closure.
This closure performs only service configuration without returning a value, and the coding guidelines require type declarations for all return values in PHP code.
Suggested change
-return static function (ContainerConfigurator $container) {
+return static function (ContainerConfigurator $container): void {📝 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) { | |
| $services = $container->services(); | |
| return static function (ContainerConfigurator $container): void { | |
| $services = $container->services(); |
🤖 Prompt for AI Agents
In `@src/Sylius/Bundle/PromotionBundle/Resources/config/services.php` around lines
35 - 36, The closure returned by the file uses the signature "return static
function (ContainerConfigurator $container)" but lacks an explicit return type;
update the anonymous configurator function signature to declare a void return
type (i.e., add ": void") so it becomes "return static function
(ContainerConfigurator $container): void" to match coding guidelines and
indicate it does not return a value.
| return static function (ContainerConfigurator $container) { | ||
| $services = $container->services(); |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# First, let's check if the file exists and read the context around lines 19-20
cat -n src/Sylius/Bundle/PromotionBundle/Resources/config/services/criteria.phpRepository: Sylius/Sylius
Length of output: 1081
🏁 Script executed:
# Search for similar configurator closures in the codebase to see if void return type is standard
rg -A 3 'return static function \(ContainerConfigurator' --type php -m 10Repository: Sylius/Sylius
Length of output: 18036
🏁 Script executed:
# Check if there are other similar service configuration files that may show the pattern
fd -e php -path '*/Resources/config/services/*' | head -20 | xargs -I {} sh -c 'echo "=== {} ===" && head -n 25 {}'Repository: Sylius/Sylius
Length of output: 225
Add explicit : void return type to the configurator closure.
This keeps return types explicit as required by coding guidelines: "Add type declarations for all properties, arguments, and return values in PHP code."
✅ Suggested change
-return static function (ContainerConfigurator $container) {
+return static function (ContainerConfigurator $container): void {🤖 Prompt for AI Agents
In `@src/Sylius/Bundle/PromotionBundle/Resources/config/services/criteria.php`
around lines 19 - 20, The returned static configurator closure should declare an
explicit void return type to satisfy coding guidelines; update the anonymous
function returned (the static function accepting ContainerConfigurator
$container) to have a ": void" return type so the signature becomes a static
function(ContainerConfigurator $container): void, keeping the
ContainerConfigurator parameter and body unchanged.
| return static function (ContainerConfigurator $container) { | ||
| $services = $container->services(); |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
find . -type f -name "validators.php" | grep -E "PromotionBundle.*config/services"Repository: Sylius/Sylius
Length of output: 133
🏁 Script executed:
cat -n src/Sylius/Bundle/PromotionBundle/Resources/config/services/validators.php | head -50Repository: Sylius/Sylius
Length of output: 3100
Add explicit : void return type to the configurator closure.
The closure lacks an explicit return type declaration. Per coding guidelines: Add type declarations for all properties, arguments, and return values in PHP code.
✅ Suggested change
-return static function (ContainerConfigurator $container) {
+return static function (ContainerConfigurator $container): void {📝 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) { | |
| $services = $container->services(); | |
| return static function (ContainerConfigurator $container): void { | |
| $services = $container->services(); |
🤖 Prompt for AI Agents
In `@src/Sylius/Bundle/PromotionBundle/Resources/config/services/validators.php`
around lines 29 - 30, Update the returned static closure to include an explicit
void return type: modify the anonymous function signature that currently reads
"return static function (ContainerConfigurator $container)" to "return static
function (ContainerConfigurator $container): void" so the closure conforms to
the project's type-declaration guidelines; ensure the change targets the closure
that assigns $services = $container->services() in validators.php.
420f012 to
2e90f1e
Compare
Summary by CodeRabbit
New Features
Chores