Docblock
in package
A docblock representation.
Based on PHP-DocBlock-Parser by Paul Scott:
Tags
Table of Contents
- $comment : string
- The entire DocBlock comment that was parsed.
- $desc : string
- The description of the symbol.
- $tags : array<string|int, mixed>
- The tags defined in the docblock.
- $vectors : array<string|int, mixed>
- Tags in the docblock that have a whitespace-delimited number of parameters (such as `@param type var desc` and `@return type desc`) and the names of those parameters.
- $reflector : mixed
- __construct() : mixed
- Docblock constructor.
- hasTag() : bool
- Whether or not a docblock contains a given @tag.
- isTagged() : bool
- Whether or not a string begins with a @tag.
- strTag() : string|null
- The tag at the beginning of a string.
- tag() : array<string|int, mixed>
- The value of a tag.
- parseComment() : mixed
- Parse the comment into the component parts and set the state of the object.
- prefixLength() : int
- Find the length of the docblock prefix.
- setComment() : mixed
- Set and parse the docblock comment.
Properties
$comment
The entire DocBlock comment that was parsed.
public
string
$comment
$desc
The description of the symbol.
public
string
$desc
$tags
The tags defined in the docblock.
public
array<string|int, mixed>
$tags
The array has keys which are the tag names (excluding the @) and values that are arrays, each of which is an entry for the tag.
In the case where the tag name is defined in DocBlock::$vectors the value within the tag-value array is an array in itself with keys as described by DocBlock::$vectors.
$vectors
Tags in the docblock that have a whitespace-delimited number of parameters (such as `@param type var desc` and `@return type desc`) and the names of those parameters.
public
static array<string|int, mixed>
$vectors
= ['throws' => ['type', 'desc'], 'param' => ['type', 'var', 'desc'], 'return' => ['type', 'desc']]
$reflector
protected
mixed
$reflector
Methods
__construct()
Docblock constructor.
public
__construct(Reflector $reflector) : mixed
Parameters
- $reflector : Reflector
Return values
mixed —hasTag()
Whether or not a docblock contains a given @tag.
public
hasTag(string $tag) : bool
Parameters
- $tag : string
-
The name of the @tag to check for
Return values
bool —isTagged()
Whether or not a string begins with a @tag.
public
static isTagged(string $str) : bool
Parameters
- $str : string
Return values
bool —strTag()
The tag at the beginning of a string.
public
static strTag(string $str) : string|null
Parameters
- $str : string
Return values
string|null —tag()
The value of a tag.
public
tag(string $tag) : array<string|int, mixed>
Parameters
- $tag : string
Return values
array<string|int, mixed> —parseComment()
Parse the comment into the component parts and set the state of the object.
protected
parseComment(string $comment) : mixed
Parameters
- $comment : string
-
The docblock
Return values
mixed —prefixLength()
Find the length of the docblock prefix.
protected
static prefixLength(array<string|int, mixed> $lines) : int
Parameters
- $lines : array<string|int, mixed>
Return values
int —Prefix length
setComment()
Set and parse the docblock comment.
protected
setComment(string $comment) : mixed
Parameters
- $comment : string
-
The docblock