Tags
The following tags are already included in PhpDocumentor::tags():
@api@author@copyright@deprecated@example@ignore@internal@link@method(all methods will be grouped inmethodsarray)@package@param(all params will be grouped inparamsarray)@property(all properties will be grouped inpropertiesarray)@property-read(also inpropertiesarray)@property-write(also inpropertiesarray)@return@see@since@throws(all exceptions will be grouped inthrowsarray)@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;
}