Skip to content

Commit 11520c1

Browse files
Merge branch '5.4' into 6.0
* 5.4: [Validator] Multi decimal to alpha for CssColor validator [Console] Fix null handling in formatAndWrap() MailerInterface: failed exception contract when enabling messenger add nonces to profiler
2 parents 276b537 + 06c3d84 commit 11520c1

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Constraints/CssColorValidator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ class CssColorValidator extends ConstraintValidator
3333
private const PATTERN_SYSTEM_COLORS = '/^(Canvas|CanvasText|LinkText|VisitedText|ActiveText|ButtonFace|ButtonText|ButtonBorder|Field|FieldText|Highlight|HighlightText|SelectedItem|SelectedItemText|Mark|MarkText|GrayText)$/i';
3434
private const PATTERN_KEYWORDS = '/^(transparent|currentColor)$/i';
3535
private const PATTERN_RGB = '/^rgb\(\s*(0|255|25[0-4]|2[0-4]\d|1\d\d|0?\d?\d),\s*(0|255|25[0-4]|2[0-4]\d|1\d\d|0?\d?\d),\s*(0|255|25[0-4]|2[0-4]\d|1\d\d|0?\d?\d)\s*\)$/i';
36-
private const PATTERN_RGBA = '/^rgba\(\s*(0|255|25[0-4]|2[0-4]\d|1\d\d|0?\d?\d),\s*(0|255|25[0-4]|2[0-4]\d|1\d\d|0?\d?\d),\s*(0|255|25[0-4]|2[0-4]\d|1\d\d|0?\d?\d),\s*(0|0?\.\d|1(\.0)?)\s*\)$/i';
36+
private const PATTERN_RGBA = '/^rgba\(\s*(0|255|25[0-4]|2[0-4]\d|1\d\d|0?\d?\d),\s*(0|255|25[0-4]|2[0-4]\d|1\d\d|0?\d?\d),\s*(0|255|25[0-4]|2[0-4]\d|1\d\d|0?\d?\d),\s*(0|0?\.\d+|1(\.0)?)\s*\)$/i';
3737
private const PATTERN_HSL = '/^hsl\(\s*(0|360|35\d|3[0-4]\d|[12]\d\d|0?\d?\d),\s*(0|100|\d{1,2})%,\s*(0|100|\d{1,2})%\s*\)$/i';
38-
private const PATTERN_HSLA = '/^hsla\(\s*(0|360|35\d|3[0-4]\d|[12]\d\d|0?\d?\d),\s*(0|100|\d{1,2})%,\s*(0|100|\d{1,2})%,\s*(0?\.\d|1(\.0)?)\s*\)$/i';
38+
private const PATTERN_HSLA = '/^hsla\(\s*(0|360|35\d|3[0-4]\d|[12]\d\d|0?\d?\d),\s*(0|100|\d{1,2})%,\s*(0|100|\d{1,2})%,\s*(0|0?\.\d+|1(\.0)?)\s*\)$/i';
3939

4040
private const COLOR_PATTERNS = [
4141
CssColor::HEX_LONG => self::PATTERN_HEX_LONG,

Tests/Constraints/CssColorValidatorTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ public function getValidRGBA(): array
225225
['rgba( 255, 255, 255, 0.3 )'], ['rgba(255, 255, 255, 0.3)'], ['rgba(255, 255, 255, .3)'],
226226
['rgba(255, 255, 255, 0.3)'], ['rgba(0, 0, 0, 0.3)'], ['rgba(0, 0, 255, 0.3)'], ['rgba(255, 0, 0, 0.3)'], ['rgba(122, 122, 122, 0.3)'], ['rgba(66, 66, 66, 0.3)'],
227227
['rgba(255,255,255,0.3)'], ['rgba(0,0,0,0.3)'], ['rgba(0,0,255,0.3)'], ['rgba(255,0,0,0.3)'], ['rgba(122,122,122,0.3)'], ['rgba(66,66,66,0.3)'],
228+
['rgba(255,255,255,1)'], ['rgba(0,0,0,0)'], ['rgba(0,0,255,1.0)'], ['rgba(255,0,0,0.3)'], ['rgba(122,122,122,.35)'], ['rgba(66,66,66,0.355)'],
228229
];
229230
}
230231

@@ -261,6 +262,7 @@ public function getValidHSLA(): array
261262
['hsla( 0, 0%, 20%, 0.4 )'], ['hsla(0, 0%, 20%, 0.4)'], ['hsla(0, 0%, 20%, .4)'],
262263
['hsla(0, 0%, 20%, 0.4)'], ['hsla(0, 100%, 50%, 0.4)'], ['hsla(147, 50%, 47%, 0.4)'], ['hsla(46, 100%, 0%, 0.4)'],
263264
['hsla(0,0%,20%,0.4)'], ['hsla(0,100%,50%,0.4)'], ['hsla(147,50%,47%,0.4)'], ['hsla(46,100%,0%,0.4)'],
265+
['hsla(0,0%,20%,1)'], ['hsla(0,100%,50%,0)'], ['hsla(147,50%,47%,1.0)'], ['hsla(46,100%,0%,.34)'], ['hsla(46,100%,0%,0.355)'],
264266
];
265267
}
266268

0 commit comments

Comments
 (0)