fix: retourne un tableau pour les Options d'un Attribut

This commit is contained in:
gcch 2026-04-14 11:30:27 +02:00
commit 2013b4e1cc

View file

@ -27,7 +27,8 @@ final readonly class Attribute {
$terms = $attribute->get_terms() ?? []; $terms = $attribute->get_terms() ?? [];
/** @var list<AttributeOption> */ /** @var list<AttributeOption> */
$options = Arr::map($terms, AttributeOption::new(...)) $options = Arr::map($terms, AttributeOption::new(...))
|> (static fn($options) => Arr::sort($options, static fn($attribute) => $attribute->id)); |> (static fn($options) => Arr::sort($options, static fn($attribute) => $attribute->id))
|> array_values(...);
return new self(name: $name, slug: $slug, options: $options); return new self(name: $name, slug: $slug, options: $options);
} }