Skip to content

[Symfony73] Wrap scalar groups option in array in ConstraintOptionsToNamedArgumentsRector#967

Merged
TomasVotruba merged 1 commit into
mainfrom
fix-constraint-groups-scalar-to-array
Jul 22, 2026
Merged

[Symfony73] Wrap scalar groups option in array in ConstraintOptionsToNamedArgumentsRector#967
TomasVotruba merged 1 commit into
mainfrom
fix-constraint-groups-scalar-to-array

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

The groups constructor argument of Symfony constraints is typed as array. When the array option value is a scalar string, the rule incorrectly passed it straight through, producing an invalid named argument.

-new Assert\NotBlank(['groups' => 'indexableFieldWithLimits']);
+new Assert\NotBlank(groups: ['indexableFieldWithLimits']);

Before this fix the rule produced groups: 'indexableFieldWithLimits' (scalar), which does not match the array parameter type.

Scalar groups values are now wrapped in an array.

@TomasVotruba
TomasVotruba enabled auto-merge (squash) July 22, 2026 21:36
@TomasVotruba
TomasVotruba merged commit f5aa845 into main Jul 22, 2026
8 checks passed
@TomasVotruba
TomasVotruba deleted the fix-constraint-groups-scalar-to-array branch July 22, 2026 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant