*/ public array $environments = []; /** * Create a new attribute instance. * * @param class-string $concrete * @param non-empty-array|non-empty-string|\UnitEnum $environments * * @throws \InvalidArgumentException */ public function __construct( string $concrete, string|array|UnitEnum $environments = ['*'], ) { $environments = array_filter(is_array($environments) ? $environments : [$environments]); if ($environments === []) { throw new InvalidArgumentException('The environment property must be set and cannot be empty.'); } $this->concrete = $concrete; $this->environments = array_map( fn ($environment) => enum_value($environment), $environments, ); } }