Home > Backend Development > PHP Tutorial > PHP coding standards (8)_PHP tutorial

PHP coding standards (8)_PHP tutorial

WBOY
Release: 2016-07-13 17:20:14
Original
802 people have browsed it

4.5 Documentation Comments

Documentation comments describe PHP classes, constructors, methods, and fields. Each documentation comment will be placed within the comment delimiter /**...*/, and one comment corresponds to a class or member. This comment should precede the declaration:


/**
 * Explain some of this class
* Describe some aspects of this class...

*/

class Example { ) does not need to be indented; subsequent documentation comments are indented 1 space per line (so that the asterisks are aligned vertically). The first line of documentation comments for members, including constructors, is indented 4 spaces, and each subsequent line is indented 5 spaces.

If you want to give information about a class, variable or method that is not suitable to be written in the documentation, you can use an implementation block comment (see 5.1.1) or a single-line comment immediately following the declaration ( See 5.1.2). For example, details about the implementation of a class should be placed in the implementation block comment immediately following the class declaration rather than in a documentation comment.

Documentation comments cannot be placed in the definition block of a method or constructor, because the program will associate the first declaration after the documentation comment with it.




http://www.bkjia.com/PHPjc/532596.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/532596.htmlTechArticle4.5 Documentation comments Documentation comments describe PHP classes, constructors, methods, and fields. Each documentation comment will be placed within the comment delimiter /**...
Note that top-level classes are not indented, but their members are indented. The first line (/**) of a documentation comment describing a class does not need to be indented; subsequent lines of documentation comments are indented by 1 space (so that the asterisks are aligned vertically). The first line of documentation comments for members, including constructors, is indented 4 spaces, and each subsequent line is indented 5 spaces. If you want to give information about a class, variable or method that is not suitable to be written in the documentation, you can use an implementation block comment (see 5.1.1) or a single-line comment immediately following the declaration ( See 5.1.2). For example, details about the implementation of a class should be placed in the implementation block comment immediately following the class declaration rather than in a documentation comment.
Documentation comments cannot be placed in the definition block of a method or constructor, because the program will associate the first declaration after the documentation comment with it. http://www.bkjia.com/PHPjc/532596.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/532596.htmlTechArticle4.5 Documentation comments Documentation comments describe PHP classes, constructors, methods, and fields. Each documentation comment will be placed within the comment delimiter /***/, and one comment corresponds to a class
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template