Lines 100.00% 1 / 1
Functions and Methods 100.00% 1 / 1
Classes and Traits 100.00% 1 / 1
Name Lines Functions and Methods CRAP Classes and Traits
Index 100.00% 1 / 1 100.00% 1 / 1 1 100.00% 1 / 1
 __construct 100.00% 1 / 1 100.00% 1 / 1 1
1<?php
2
3declare(strict_types=1);
4
5namespace BlueprintAU\Radiant\Attributes;
6
7/**
8 * Declares an index over one or more columns (class-level).
9 *
10 * Single-column convenience stays on {@see Column}'s `index` flag; use this
11 * attribute for composite indexes — or any index needing a custom name the
12 * flag cannot express. Column names are validated against the model's
13 * `#[Column]` set at build time by the {@see \BlueprintAU\Radiant\Metadata\MetadataFactory}.
14 */
15#[\Attribute(\Attribute::TARGET_CLASS | \Attribute::IS_REPEATABLE)]
16final class Index
17{
18    /**
19     * Create an index declaration.
20     *
21     * @param  list<string>  $columns
22     * @param  string|null  $name
23     * @param  string|null  $where
24     */
25    public function __construct(
26        public array $columns,
27        public ?string $name = null,
28        public ?string $where = null,
29    ) {
30    }
31}