Skip to content

Tag reference

@uses

The @uses tag documents that the described element uses — depends on — the referenced one. Where @see is a loose “read also” pointer, @uses (together with its inverse, @used-by) is meant to express a real dependency relationship worth tracking: if the referenced element changes behavior, the element carrying @uses may break. This makes the relationship visible from the dependent side, even when the referenced element carries no annotation of its own.

Grammar

"@uses" <Reference> [ <Description> ]

Examples

A method documenting the helper it relies on.
/**
* @uses normalizeAddress()
*/
function send(string $address): void
{
/* ... */
}
With a description explaining the dependency.
/**
* @uses Config::DEFAULT_TIMEOUT Falls back to this when none is
* given.
*/
function connect(?int $timeout = null): void
{
/* ... */
}

Names by platform

phpdocumentor
@uses

Parsing a @uses tag produces a ReferenceTag instance narrowed to a CodeReference (a class, function, method, constant, property, or variable — never an external URI), exposing $reference.

final class UsesTag extends ReferenceTag
{
// extends ReferenceTag<CodeReference>
// directly; adds nothing beyond the
// inherited $reference, $name and
// $description.
}

Defined by the PSR-19 draft (FIG proposed PHPDoc Tags, §5.17) and by phpDocumentor, which also documents its inverse, @used-by, on the same page.