Skip to content

Tag reference

@version

The @version tag documents the current version of the element it annotates, most often placed once on a file or class to record which release it corresponds to. This differs from @since, which records when a particular feature was first introduced: @version names what the element currently is, not when any part of it arrived.

Grammar

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

Examples

Tagging a class with the release it ships in.
/**
* @version 1.4.2
*/
final class Mailer {}
With a short description alongside the version.
/**
* @version 2.0.0-beta.1 Transport negotiation is not yet finalized.
*/

Names by platform

phpdocumentor
@version

Parsing a @version tag produces a VersionTag instance exposing $version โ€” the current version of the element, or null when none was given โ€” alongside the inherited $description. It shares this shape with @since and @deprecated.

final class VersionTag extends VersionedTag
{
// extends VersionedTag; adds nothing
// beyond the inherited $version,
// $name and $description.
}

Defined by the PSR-19 draft (FIG proposed PHPDoc Tags, ยง5.19) and by phpDocumentor.