label) === '') { throw new InvalidArgumentException('RenderedAttribute label must be a non-empty string.'); } if (! in_array($this->priority, ['primary', 'secondary'], true)) { throw new InvalidArgumentException('RenderedAttribute priority must be either "primary" or "secondary".'); } } /** * @return array{label: string, value: string, priority: string} */ public function toArray(): array { return [ 'label' => $this->label, 'value' => $this->value, 'priority' => $this->priority, ]; } }