| Start |
|---|
| Adding metadata to functions Function level annotations help IDEs identify return values or potentially dangerous code |
| Describing a variable The
The type can be one of the built-in PHP types, or a user-defined class, including namespaces. The name of the variable should be included, but can be omitted if the docblock applies to only one item. |
| Adding metadata to files File level metadata applies to all the code within the file and should be placed at the top of the file: |
| Inheriting metadata from parent structures If a class extends another class and would use the same metadata, providing it |
Describing parameters |
| Collections PSR-5 (opens new window) proposes a form of Generics-style notation for collections. Generics SyntaxValues in a Collection MAY even be another array and even another Collection. ExamplesSyntax
Remarks"PHPDoc" is a section of documentation which provides information on aspects of a "Structural Element" — PSR-5 (opens new window) PHPDoc annotations are comments that provide metadata about all types of structures in PHP. Many popular IDEs are configured by default to utilize PHPDoc annotations to provide code insights and identify possible problems before they arise. While PHPDoc annotations are not part of the PHP core, they currently hold draft status with PHP-FIG (opens new window) as PSR-5 (opens new window). All PHPDoc annotations are contained within DocBlocks that are demonstrated by a multi-line with two asterisks: The full PHP-FIG (opens new window) standards draft is available on GitHub (opens new window). |
Read Article
https://develop.horje.com/learn/1434/reference