Search by

type-lang / phpdoc-standard-tags

Serafim

This package is abandoned and no longer maintained. The author suggests using the type-lang/phpdoc package instead.

Adds support for standard PHPDoc tags

Package info

github.com/php-type-language/phpdoc-standard-tags

pkg:composer/type-lang/phpdoc-standard-tags

Statistics

Installs: 18 623

Dependents: 1

Suggesters: 1

Stars: 0

Open Issues: 0

1.0.1 2025-01-11 00:11 UTC

This package is auto-updated.

Last update: 2026-07-12 18:46:07 UTC


README

PHP 8.1+ Latest Stable Version Latest Unstable Version License MIT

Abandoned: Since version 2.0, this phpdoc tag set is built-in to the phpdoc package.

Adds support of the PHPDoc standard DocBlock tags.

Read documentation pages for more information.

Installation

TypeLang PHPDoc Standard Tags is available as Composer repository and can be installed using the following command in a root of your project:

composer require type-lang/phpdoc-standard-tags

Introduction

Adds support for basic annotations containing descriptions of types that affect their output in static analyzers.

  • @method — TypeLang\PHPDoc\Standard\MethodTagFactory
  • @param — TypeLang\PHPDoc\Standard\ParamTagFactory
  • @property — TypeLang\PHPDoc\Standard\PropertyTagFactory
  • @property-read — TypeLang\PHPDoc\Standard\PropertyReadTagFactory
  • @property-write — TypeLang\PHPDoc\Standard\PropertyWriteTagFactory
  • @return — TypeLang\PHPDoc\Standard\ReturnTagFactory
  • @throws — TypeLang\PHPDoc\Standard\ThrowsTagFactory
  • @var — TypeLang\PHPDoc\Standard\VarTagFactory

Usage

use TypeLang\PHPDoc\Parser;
use TypeLang\PHPDoc\Standard;
use TypeLang\PHPDoc\Tag\Factory\TagFactory;

$tags = new TagFactory();

// Add support of standard tags
$tags->register('method', new Standard\MethodTagFactory());
$tags->register('param', new Standard\ParamTagFactory());
$tags->register('property', new Standard\PropertyTagFactory());
$tags->register('property-read', new Standard\PropertyReadTagFactory());
$tags->register('property-write', new Standard\PropertyWriteTagFactory());
$tags->register('return', new Standard\ReturnTagFactory());
$tags->register('throws', new Standard\ThrowsTagFactory());
$tags->register('var', new Standard\VarTagFactory());

$docblock = (new Parser($tags))
    ->parse(<<<'PHPDOC'
        /**
         * @var string example tag.
         */
        PHPDOC);

var_dump($docblock);