<?php
#[Attribute(Attribute::TARGET_CLASS|Attribute::TARGET_FUNCTION|Attribute::TARGET_METHOD)]
class Template
{
public function __construct(
public string $name,
public ?string $of = null,
) {}
}
#[Attribute(Attribute::TARGET_FUNCTION|Attribute::TARGET_METHOD|Attribute::TARGET_PARAMETER|Attribute::TARGET_PROPERTY)]
class Type
{
public function __construct(
public string $name,
) {}
}
#[Template(T)]
#[Type(array<int,T>)]
function asArray(
#[Type(T)] $value,
): array {
return [$value];
}