The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:
The ReflectionDocBlock component of phpDocumentor provides a DocBlock parser that is 100% compatible with the PHPDoc standard.
With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.
composer require phpdocumentor/reflection-docblock
In order to parse the DocBlock one needs a DocBlockFactory that can be instantiated using its
createInstancefactory method like this:
$factory = \phpDocumentor\Reflection\DocBlockFactory::createInstance();
Then we can use the
createmethod of the factory to interpret the DocBlock. Please note that it is also possible to provide a class that has the
getDocComment()method, such as an object of type
ReflectionClass, the create method will read that if it exists.
$docComment = <<create($docComment);
createmethod will yield an object of type
\phpDocumentor\Reflection\DocBlockwhose methods can be queried:
// Contains the summary for this DocBlock $summary = $docblock->getSummary();
// Contains \phpDocumentor\Reflection\DocBlock\Description object $description = $docblock->getDescription();
// You can either cast it to string $description = (string) $docblock->getDescription();
// Or use the render method to get a string representation of the Description. $description = $docblock->getDescription()->render();