PHP coding specifications (8)

Source: Internet
Author: User
4.5 document comments describe php classes, constructors, methods, and fields ). Each document annotation is placed in the annotation separator/**... */, and a comment corresponds to a class or member. This annotation should be prior to the declaration:/*** describes some of this class... */classExample {... note SyntaxHighlighte 4.5 document comment

This document describes php classes, constructors, methods, and fields ). Each document annotation is placed in the annotation separator/**... */, and a comment corresponds to a class or member. The comment should be prior to the declaration:


/**
* Describes some of the classes...
*/
Class Example {...

Note that the top-level class is not indented, and its members are indented. The first line (/**) of the document comment of the description class does not need to be indented; the subsequent document comment lines are indented by 1 (vertical alignment of the asterisks ). Member, including the constructor, the first line of the comments in the document is indented by 4 cells, and then each line is indented by 5 cells.

If you want to provide information about classes, variables, or methods that are not suitable for writing in the document, you can use implementation block annotations (see 5.1.1) or a single line comment that follows the declaration (see 5.1.2 ). For example, the implementation details of a class should be placed in the implementation block comment followed by the class declaration, rather than in the document comment.

Document comments cannot be placed in the definition block of a method or constructor, because the program associates the first declaration after the document comments with it.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.