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
Copy file name to clipboardExpand all lines: src/TwigComponent/src/ComponentAttributes.php
+8-8Lines changed: 8 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -51,19 +51,19 @@ function (string $carry, string $key) {
51
51
$value = (string) $value;
52
52
}
53
53
54
-
if (\is_bool($value) && str_starts_with($key, 'aria-')) {
55
-
$value = $value ? 'true' : 'false';
56
-
}
57
-
58
54
if (!\is_scalar($value) && null !== $value) {
59
-
thrownew \LogicException(sprintf('A "%s" prop was passed when creating the component. No matching "%s" property or mount() argument was found, so we attempted to use this as an HTML attribute. But, the value is not a scalar (it\'s a %s). Did you mean to pass this to your component or is there a typo on its name?', $key, $key, get_debug_type($value)));
55
+
thrownew \LogicException(sprintf('A "%s" prop was passed when creating the component. No matching "%s" property or mount() argument was found, so we attempted to use this as an HTML attribute. But, the value is not a scalar (it\'s a "%s"). Did you mean to pass this to your component or is there a typo on its name?', $key, $key, get_debug_type($value)));
60
56
}
61
57
62
58
if (null === $value) {
63
59
trigger_deprecation('symfony/ux-twig-component', '2.8.0', 'Passing "null" as an attribute value is deprecated and will throw an exception in 3.0.');
64
60
$value = true;
65
61
}
66
62
63
+
if (true === $value && str_starts_with($key, 'aria-')) {
64
+
$value = 'true';
65
+
}
66
+
67
67
returnmatch ($value) {
68
68
true => "{$carry}{$key}",
69
69
false => $carry,
@@ -89,12 +89,12 @@ public function render(string $attribute): ?string
89
89
$value = (string) $value;
90
90
}
91
91
92
-
if (\is_bool($value) && str_starts_with($attribute, 'aria-')) {
93
-
$value = $value ? 'true' : 'false';
92
+
if (true === $value && str_starts_with($attribute, 'aria-')) {
93
+
$value = 'true';
94
94
}
95
95
96
96
if (!\is_string($value)) {
97
-
thrownew \LogicException(sprintf('Can only get string attributes (%s is a %s).', $attribute, get_debug_type($value)));
97
+
thrownew \LogicException(sprintf('Can only get string attributes (%s is a "%s").', $attribute, get_debug_type($value)));
0 commit comments