Methods |
final
public
|
__construct(
?string $docBlock = null,
self|string|null $classDocBlock = null,
class-string|null $class = null,
?string $member = null,
array<string, class-string> $aliases = [],
)
Creates a new PHPDoc object from a PHP DocBlock
Creates a new PHPDoc object from a PHP DocBlock
|
#
|
public
static
|
forClass(
ReflectionClass<object> $class,
bool $trackInheritance = false,
array<string, class-string> $aliases = [],
): static
Creates a new PHPDoc object for a class from its doc comments
Creates a new PHPDoc object for a class from its doc comments
|
#
|
public
static
|
forMethod(
ReflectionMethod $method,
ReflectionClass<object>|null $class = null,
array<string, class-string> $aliases = [],
): static
Creates a new PHPDoc object for a method from its doc comments
Creates a new PHPDoc object for a method from its doc comments
|
#
|
public
static
|
forProperty(
ReflectionProperty $property,
ReflectionClass<object>|null $class = null,
array<string, class-string> $aliases = [],
): static
Creates a new PHPDoc object for a property from its doc comments
Creates a new PHPDoc object for a property from its doc comments
|
#
|
public
static
|
forConstant(
ReflectionClassConstant $constant,
ReflectionClass<object>|null $class = null,
array<string, class-string> $aliases = [],
): static
Creates a new PHPDoc object for a class constant from its doc comments
Creates a new PHPDoc object for a class constant from its doc comments
|
#
|
public
static
|
fromTags(
AbstractTag[] $tags,
?string $summary = null,
?string $description = null,
class-string|null $class = null,
?string $member = null,
): static
Creates a new PHPDoc object from an array of tag objects
Creates a new PHPDoc object from an array of tag objects
|
#
|
public
|
inherit(self $parent): static
Inherit values from an instance that represents the same structural
element in a parent class or interface
Inherit values from an instance that represents the same structural
element in a parent class or interface
|
#
|
public
|
normalise(): static
Get a normalised instance
Get a normalised instance
If the PHPDoc has one @var tag:
- if the class member associated with the PHPDoc is a property with the
same name as the tag, the name is removed from the tag
- if the tag has no name, its description is applied to the summary or
description of the PHPDoc and removed from the tag
@inheritDoc tags are removed.
|
#
|
public
|
flatten(): static
Flatten values inherited from other instances and forget the initial
state of the PHPDoc
Flatten values inherited from other instances and forget the initial
state of the PHPDoc
|
#
|
public
|
getOriginal(): static
Get the state of the PHPDoc before inheriting values from other instances
Get the state of the PHPDoc before inheriting values from other instances
|
#
|
public
|
getSummary(): ?string
Get the PHPDoc's summary
|
#
|
public
|
getDescription(): ?string
Get the PHPDoc's description
Get the PHPDoc's description
|
#
|
public
|
hasTag(string $name): bool
Check if the PHPDoc has a tag with the given name
Check if the PHPDoc has a tag with the given name
|
#
|
public
|
getTags(): array<string, AbstractTag[]>
Get the PHPDoc's tags, indexed by tag name
Get the PHPDoc's tags, indexed by tag name
|
#
|
public
|
getParams(): array<string, ParamTag>
Get the PHPDoc's "@param" tags, indexed by name
Get the PHPDoc's "@param" tags, indexed by name
|
#
|
public
|
hasReturn(): bool
Check if the PHPDoc has a "@return" tag
Check if the PHPDoc has a "@return" tag
|
#
|
public
|
getReturn(): ?ReturnTag
Get the PHPDoc's "@return" tag
Get the PHPDoc's "@return" tag
|
#
|
public
|
getVars(): VarTag[]
Get the PHPDoc's "@var" tags
Get the PHPDoc's "@var" tags
|
#
|
public
|
getMethods(): array<string, MethodTag>
Get the PHPDoc's "@method" tags, indexed by name
Get the PHPDoc's "@method" tags, indexed by name
|
#
|
public
|
getProperties(): array<string, PropertyTag>
Get the PHPDoc's "@property" tags, indexed by name
Get the PHPDoc's "@property" tags, indexed by name
|
#
|
public
|
getTemplates(bool $includeClass = true): array<string, TemplateTag>
Get the PHPDoc's "@template" tags, indexed by name
Get the PHPDoc's "@template" tags, indexed by name
|
#
|
public
|
getTemplatesForTag(AbstractTag $tag): array<string, TemplateTag>
Get "@template" tags applicable to the given tag, indexed by name
Get "@template" tags applicable to the given tag, indexed by name
|
#
|
public
|
hasErrors(): bool
Check if any tags in the PHPDoc's original DocBlock failed to parse
Check if any tags in the PHPDoc's original DocBlock failed to parse
|
#
|
public
|
getErrors(): ErrorTag[]
Get any tags that failed to parse
Get any tags that failed to parse
|
#
|
public
|
getClass(): ?string
Get the name of the class associated with the PHPDoc
Get the name of the class associated with the PHPDoc
|
#
|
public
|
getMember(): ?string
Get the class member associated with the PHPDoc
Get the class member associated with the PHPDoc
|
#
|
public
|
isEmpty(): bool
Check if the PHPDoc has no content
Check if the PHPDoc has no content
|
#
|
public
|
hasDetail(): bool
Check if the PHPDoc has data other than a summary and standard type
information
Check if the PHPDoc has data other than a summary and standard type
information
|
#
|
public
|
__toString(): string
|
#
|
public
static
|
fromDocBlocks(
array<class-string|int, string|null> $docBlocks,
array<class-string|int, self|string|null>|null $classDocBlocks = null,
?string $member = null,
array<string, class-string> $aliases = [],
): static
Creates a new PHPDoc object from an array of PHP DocBlocks, each of which
inherits from subsequent blocks
Creates a new PHPDoc object from an array of PHP DocBlocks, each of which
inherits from subsequent blocks
|
#
|
Constants |
protected
|
DEFAULT_TAG_PREFIXES = ['', 'phpstan-', 'psalm-']
|
#
|
protected
|
INHERITABLE_TAGS = [
'author' => false,
'copyright' => false,
'version' => false,
'package' => false,
'param' => true,
'return' => true,
'throws' => true,
'var' => true,
'method' => true,
'property' => true,
'property-read' => ['phpstan-', 'psalm-'],
'property-write' => ['phpstan-', 'psalm-'],
'mixin' => true,
'param-out' => true,
'param-immediately-invoked-callable' => ['', 'phpstan-'],
'param-later-invoked-callable' => ['', 'phpstan-'],
'param-closure-this' => ['', 'phpstan-'],
'deprecated' => false,
'readonly' => false,
]
|
#
|
protected
|
INHERITABLE_BY_CLASS_TAGS = [
'method' => true,
'property' => true,
'property-read' => ['phpstan-', 'psalm-'],
'property-write' => ['phpstan-', 'psalm-'],
'mixin' => true,
]
|
#
|
protected
|
MERGED_TAGS = ['param' => true, 'return' => true, 'var' => true, 'method' => true, 'property' => true]
|
#
|
protected
|
STANDARD_TAGS = [
'param',
'return',
'throws',
'var',
'template',
'template-covariant',
'template-contravariant',
'api',
'internal',
'inheritDoc',
'readonly',
]
|
#
|