Skip to content

Extending

Tags

A tag is what a @tag line becomes. Every tag has a $name (without the @) and an optional $description, a tag known by its name adds its own parts: @param has a $type and a $variable, @see a $reference.

class Tag implements TagInterface
{
public function __construct(
public readonly string $name = '',
public readonly ?DescriptionInterface $description = null,
) {}
}

A tag of your own extends Tag and adds what its line holds:

// @money 100 USD The price
final class MoneyTag extends Tag
{
public function __construct(
string $name,
public readonly int $amount,
public readonly string $currency,
?DescriptionInterface $description = null,
) {
parent::__construct($name, $description);
}
}

How the line is read is not a concern of the tag: it is created by its definition.