You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
minor #43369 [Validator] [CssColor] Fixed default behavior (welcoMattic)
This PR was merged into the 5.4 branch.
Discussion
----------
[Validator] [CssColor] Fixed default behavior
| Q | A
| ------------- | ---
| Branch? | 5.4
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets |
| License | MIT
| Doc PR | symfony/symfony-docs#... <!-- required for new features -->
Following the `@javiereguiluz` PR in docs (symfony/symfony-docs#15906), I figured out I've missed the default behavior of the constraint, which is "all formats are valid if you pass no arguments". It's fixed.
I've also replaced an overengineered `array_reduce` with an `implode`.
Tests have been updated too.
Commits
-------
cac2ccfcb5 Fixed default behavior
if ([] === array_intersect(static::$validationModes, $formats)) {
77
+
if ([] === array_intersect(self::$validationModes, $formats)) {
78
78
thrownewInvalidArgumentException(sprintf('The "formats" parameter value is not valid. It must contain one or more of the following values: "%s".', $validationModesAsString));
79
79
}
80
80
81
81
$options['value'] = $formats;
82
82
} elseif (\is_string($formats)) {
83
-
if (!\in_array($formats, static::$validationModes)) {
83
+
if (!\in_array($formats, self::$validationModes)) {
84
84
thrownewInvalidArgumentException(sprintf('The "formats" parameter value is not valid. It must contain one or more of the following values: "%s".', $validationModesAsString));
0 commit comments