Adds support of the PHPDoc standard DocBlock tags.
Read documentation pages for more information.
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
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
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);