class ReflectionDocComment implements StringRepresentation (View source)

Documentation comment reflection

Constants

PATTERN_COMMENT_PREFIX

PATTERN_COMMENT_SUFFIX

PATTERN_COMMENT_END

PATTERN_PROPERTY_DECLARATION

PATTERN_VARIABLE_DECLARATION

PATTERN_TYPE_ARRAY_OF_TYPE

PATTERN_TYPE_MAP

Methods

static string[]
getTypeDeclarationProperties(string $declaration)

Get information on PHPDoc type declaration

__construct(string $text)

No description

string
__toString()

No description

string[]
getTags(string $name)

Get all lines starting with the given documentation tag

string[]
getTextLines()

Get all lines which are not tags

string|NULL
getAbstract()

Get first text line

NULL|string|string[]
getDetails(string|NULL $glue = null)

Get detailed description lines.

boolean
hasTag(string $name)

Indicates if the DocComment has at least one occurence of the given tag.

string
getTag(string $name, number $index = 0)

Get the nth line containing the given documentation tag

string[]|NULL
getParameter(string $name)

Get type and documentation of the given function parameter.

string[]|NULL
getVariable(string|NULL $name = null)

Get variable type and documentation.

string[]|NULL
getReturn()

Get return value types and return value documentation given by the @return tag.

string[]
getLines()

Get cleaned documentation lines

Details

static string[] getTypeDeclarationProperties(string $declaration)

Get information on PHPDoc type declaration

Parameters

string $declaration A type declaration appearing in @param, @var or @return

Return Value

string[] A Type properties

  • type: The type name without decoration
  • *
  • key: For array type, the array keys type/li> *
  • value: For array type, The array values type

__construct(string $text)

Parameters

string $text Documentation comment

string __toString()

Return Value

string The string representation of the class instance

string[] getTags(string $name)

Get all lines starting with the given documentation tag

Parameters

string $name Tag name

Return Value

string[]

string[] getTextLines()

Get all lines which are not tags

Return Value

string[] Text lines

string|NULL getAbstract()

Get first text line

Return Value

string|NULL First text line if any

NULL|string|string[] getDetails(string|NULL $glue = null)

Get detailed description lines.

The detailed description lines are all text lines except the first one.

Parameters

string|NULL $glue If set, merge line with this glue.

Return Value

NULL|string|string[] Text lines corresponding to the detailed description.

boolean hasTag(string $name)

Indicates if the DocComment has at least one occurence of the given tag.

Parameters

string $name Tag name.

Return Value

boolean

string getTag(string $name, number $index = 0)

Get the nth line containing the given documentation tag

Parameters

string $name Tag name
number $index Tag index

Return Value

string

string[]|NULL getParameter(string $name)

Get type and documentation of the given function parameter.

Parameters

string $name Parameter name

Return Value

string[]|NULL Associative array with the following keys

    ²li>types
  • documentation

string[]|NULL getVariable(string|NULL $name = null)

Get variable type and documentation.

Parameters

string|NULL $name Variable name. If NULL, Find the first @var tag.

Return Value

string[]|NULL Associative array with the following keys

    ²li>types
  • documentation

string[]|NULL getReturn()

Get return value types and return value documentation given by the @return tag.

Return Value

string[]|NULL Associative array with the following keys

    ²li>types
  • documentation

string[] getLines()

Get cleaned documentation lines

Return Value

string[]