Skip to content

Commit 8cb8c42

Browse files
committed
support for php 8.0
1 parent fd6c82d commit 8cb8c42

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/TwigComponent/src/ComponentAttributes.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,10 @@ public function all(): array
6868
*/
6969
public function defaults(iterable $attributes): self
7070
{
71-
$attributes = [...$attributes];
71+
if ($attributes instanceof \Traversable) {
72+
$attributes = iterator_to_array($attributes);
73+
}
74+
7275
foreach ($this->attributes as $key => $value) {
7376
if (\in_array($key, ['class', 'data-controller'], true) && isset($attributes[$key])) {
7477
$attributes[$key] = "{$attributes[$key]} {$value}";

0 commit comments

Comments
 (0)