Skip to content

DocBlock

The prose and tags of one docblock, already separated into the parts a page renders.

Types here are still the raw strings the author wrote. Turning them into a TypeRef needs the declaring file’s imports, which only the reflector has, so that conversion happens there rather than at parse time.

final class DocBlock

SourceIr/DocBlock.php
PropertyTypeDescription
$deprecated?``stringreadonly.
$descriptionstringreadonly.
$inheritsDocboolreadonly.
$internalboolreadonly.
$paramDescriptionsarrayreadonly.
$paramTypesarrayreadonly.
$returnDescriptionstringreadonly.
$returnType?``stringreadonly.
$seearrayreadonly.
$since?``stringreadonly.
$summarystringreadonly.
$throwsarrayreadonly.

public function __construct(string $summary = '', string $description = '', array<string, string> $paramDescriptions = [], array<string, string> $paramTypes = [], ?string $returnType = null, string $returnDescription = '', list<array{type: string, description: string}> $throws = [], ?string $deprecated = null, bool $internal = false, ?string $since = null, list<string> $see = [], bool $inheritsDoc = false): mixed

Raw @see targets, in source order.

ParameterTypeDescription
$summarystring
$descriptionstring
$paramDescriptionsarray``<``string``, ``string``>Parameter name (no $) => description.
$paramTypesarray``<``string``, ``string``>Parameter name (no $) => raw type text.
$returnType?``string
$returnDescriptionstring
$throwslist``<``array{type: string, description: string}``>
$deprecated?``string
$internalbool
$since?``string
$seelist``<``string``>Raw @see targets, in source order.
$inheritsDocbool

Returns mixed

MethodDescription
empty(): DocBlock
inheritFrom(DocBlock $parent): DocBlockReturns a copy carrying $parent’s prose wherever this block left it out.
isEmpty(): bool

public static function empty(): DocBlock

Returns DocBlock

public function inheritFrom(DocBlock $parent): DocBlock

Returns a copy carrying $parent’s prose wherever this block left it out.

Used for “, and for the common case of an override with tags but no summary: the ancestor’s description is the right one, and the override’s own tags still win because they describe this signature.

ParameterTypeDescription
$parentDocBlock

Returns DocBlock

public function isEmpty(): bool

Returns bool