Skip to content

Tag reference

@deprecated

The @deprecated tag marks an element as no longer recommended for use. It warns consumers that the element may be removed in a future release, and optionally names the version starting from which it should be considered deprecated and what to use in its place.

Grammar

"@deprecated" [ <Version> ] [ <Description> ]

Examples

Naming the version and pointing to a replacement.
/**
* @deprecated 2.0 Use Mailer::send() instead.
*/
public function dispatch(Message $message): bool
Without a version, just explaining the reason.
/**
* @deprecated No longer needed now that transport is chosen
* automatically.
*/
public function withTransport(Transport $transport): static

Names by platform

standard
@deprecated

Parsing a @deprecated tag produces a DeprecatedTag instance exposing $version — the version since which the element is deprecated, or null when none was given — alongside the inherited $description.

final class DeprecatedTag extends VersionedTag {}

VersionedTag itself declares the $version property (and the constructor that fills it in) — DeprecatedTag adds nothing of its own.

Defined by the PSR-19 draft PHPDoc Tags proposal and phpDocumentor’s tag reference.