type-lang / phpdoc-standard-tags
Adds support for standard PHPDoc tags
1.0.0
2024-06-30 11:12 UTC
Requires
- php: ^8.1
- type-lang/parser: ^1.0
- type-lang/phpdoc: ^1.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.53
- nikic/php-parser: ^4.19|^5.0
- phpstan/extension-installer: ^1.3
- phpstan/phpstan: ^1.11
- phpstan/phpstan-strict-rules: ^1.6
- phpunit/phpunit: ^10.5|^11.0
- rector/rector: ^1.0
- symfony/finder: ^5.4|^6.0|^7.0
- type-lang/printer: >=1.0.0-beta2 <2.0
This package is auto-updated.
Last update: 2024-09-02 07:46:11 UTC
README
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);