Php file comment mark and standard summary

Source: Internet
Author: User
Php file annotation mark and standard summary. php developers can add them to their favorites for future use, making our code more professional. PHP annotation mark

@ Access
Usage scope: class, function, var, define, module
Indicates the access permission for a keyword: private, public, or proteced.

@ Author
Specify author

@ Copyright
Usage scope: class, function, var, define, module, use
Copyright information

@ Deprecated
Usage scope: class, function, var, define, module, constent, global, include
Specify unnecessary or obsolete keywords

@ Example
This tag is used to parse the content of a file and highlight it. Phpdoc will try to read the file content from the file path marked

@ Const
Scope of use: define
Used to specify the define constant in php

@ Final
Usage scope: class, function, var
Specifies that a keyword is a final class, method, or attribute, and cannot be derived or modified.

@ Filesource
Similar to example, however, this tag will directly read and display the content of the currently resolved php file.

@ Global
Specifies the global variables referenced in this function.

@ Ingore
Used to ignore specified keywords in the document

@ License
It is equivalent to the URL in the html tag, followed by the content to be displayed.
For example, Baidu
Can Write @ license http://www.baidu.com Baidu

@ Link
Similar to license
However, you can refer to any keyword in the document through link.

@ Name
Specify an alias for the keyword.

@ Package
Scope of use: page-> define, function, include
Class-> class, var, methods
It is used to logically group one or more keywords into one group.

@ Shortcut
Indicates that the current class is an abstract class.

@ Param
Specify the parameters of a function.

@ Return
Specifies the return value of a method or function.

@ Static
Indicates that the word is static.

@ Var
Variable type

@ Version
Specify version information

@ Todo
Specify the areas to be improved or not implemented

@ Throws
Indicates the error exception that this function may throw.

A common document tag must start with @ at the beginning of each line. In addition, there is also a tag called inline tag, represented by {@}, which includes the following types:

{@ Link}
Usage: @ link

{@ Source}
Display the content of a function or method

Annotation specification

A. The comment must be

/**
* Comment content
*/

Format

B. The glboal mark must be used for functions that reference global variables.

C. for variables, you must use var to mark their types (int, string, bool ...)

D. the function must specify its parameters and return values through param and return tags.

E. for keywords that appear twice or more times, ignore unnecessary keywords through ingore and retain only one keyword.

F. when other functions or classes are called, link or other markup should be used to link to the corresponding part for easy reading of the document.

G. use non-document comments as necessary to improve ease of coding.

H. The descriptive content should be as concise as possible and use phrases instead of sentences as much as possible.

I. global variables, static variables and constants must be marked with corresponding descriptions

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.