Skip to content

Commit 4eefe39

Browse files
committed
bug symfony#44877 [Validator] Error using CssColor with doctrine annotations (sormes)
This PR was squashed before being merged into the 5.4 branch. Discussion ---------- [Validator] Error using CssColor with doctrine annotations | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | none | License | MIT When use doctrine annotations and set formats parameter throw and error `array_merge(): Argument #2 must be of type array, null given` `in vendor/symfony/validator/Constraints/CssColor.php (line 75) ` Commits ------- bba6e15 [Validator] Error using CssColor with doctrine annotations
2 parents 1e76053 + bba6e15 commit 4eefe39

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Component/Validator/Constraints/CssColor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function __construct($formats = [], string $message = null, array $groups
7272
if (!$formats) {
7373
$options['value'] = self::$validationModes;
7474
} elseif (\is_array($formats) && \is_string(key($formats))) {
75-
$options = array_merge($formats, $options);
75+
$options = array_merge($formats, $options ?? []);
7676
} elseif (\is_array($formats)) {
7777
if ([] === array_intersect(self::$validationModes, $formats)) {
7878
throw new InvalidArgumentException(sprintf('The "formats" parameter value is not valid. It must contain one or more of the following values: "%s".', $validationModesAsString));

0 commit comments

Comments
 (0)