Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

License

NotificationsYou must be signed in to change notification settings

phpDocumentor/ReflectionDocBlock

Repository files navigation

License: MITIntegrateScrutinizer Code CoverageScrutinizer Code QualityStable VersionUnstable Version

ReflectionDocBlock

Introduction

The ReflectionDocBlock component of phpDocumentor provides a DocBlock parserthat is 100% compatible with thePHPDoc standard.

With this component, a library can provide support for annotations via DocBlocksor otherwise retrieve information that is embedded in a DocBlock.

Installation

composer require phpdocumentor/reflection-docblock

Usage

In order to parse the DocBlock one needs a DocBlockFactory that can beinstantiated using itscreateInstance factory method like this:

$factory  = \phpDocumentor\Reflection\DocBlockFactory::createInstance();

Then we can use thecreate method of the factory to interpret the DocBlock.Please note that it is also possible to provide a class that has thegetDocComment() method, such as an object of typeReflectionClass, thecreate method will read that if it exists.

$docComment =<<<DOCCOMMENT/** * This is an example of a summary. * * This is a Description. A Summary and Description are separated by either * two subsequent newlines (thus a whiteline in between as can be seen in this * example), or when the Summary ends with a dot (`.`) and some form of * whitespace. */DOCCOMMENT;$docblock =$factory->create($docComment);

Thecreate method 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();

For more examples it would be best to review the scripts in the/examples folder.

About

No description or website provided.

Topics

Resources

License

Stars

Watchers

Forks


[8]ページ先頭

©2009-2025 Movatter.jp