Tags
The following tags are already included in PhpDocumentor::tags()
:
@api
@author
@copyright
@deprecated
@example
@ignore
@internal
@link
@method
(all methods will be grouped inmethods
array)@package
@param
(all params will be grouped inparams
array)@property
(all properties will be grouped inproperties
array)@property-read
(also inproperties
array)@property-write
(also inproperties
array)@return
@see
@since
@throws
(all exceptions will be grouped inthrows
array)@todo
@uses
@used-by
@var
So if you only need to parse those tags, you can simply do:
//$doc = ...; Get doc-comment string from reflection
$tags = PhpDocumentor::tags();
$parser = new PhpdocParser($tags);
$meta = $parser->parse($doc);
Tags classes
Here’s a list of available tags classes, that should cover most of the use cases:
- Summery
- ArrayTag
- CustomTag
- DescriptionTag
- ExampleTag
- FlagTag
- MapTag
- MethodTag
- ModifyTag
- MultiTag
- NumberTag
- RegExpTag
- VarTag
- WordTag
The following function is used in tags documentation, for short reference to parsing:
function getNotations(string $doc, array $tags = []) {
$tags = PhpDocumentor::tags()->add($tags);
$parser = new PhpdocParser($tags);
$notations = $parser->parse($doc);
return $notations;
}