ArrayOf v1.0.0
ValidationRule и hint конверсии: list элементов заданного типа.
Описание: Атрибут «список элементов типа T». В ReflectionMapper управляет конверсией элементов; как ValidationRule проверяет list и типы. Repeatable.
Namespace: Devcraft\Attributes
Target: Attribute::TARGET_PROPERTY | Attribute::IS_REPEATABLE
Implements: ValidationRule
С версии: 1.0.0
См. также:
__construct(string $type)
Параметры:
$type(string): builtin (string,int, …) или FQCN класса/интерфейса
Public property: $type
validate(mixed $value): ?string
Описание: null проходит. Не list → must be a list of {type}. Элемент не соответствует типу → то же сообщение.
Встроенные: mixed, string, int/integer, float/double, bool/boolean, array, object. Иначе — instanceof.
#[ArrayOf(Address::class)]
public array $locations = [];