Add a specification comment to the PHP code phpdocumentor

Source: Internet
Author: User
Tags deprecated

More reference http://phpdoc.org/docs/latest/index.html
In Phpdocumentor, comments are divided into document comments and non-document comments.
The so-called document comments, are those placed in front of a particular keyword, the multi-line comment, the specific keyword refers to be able to be phpdoc analysis of keywords, such as Class,var, specific can participate in Appendix 1.
Comments that are not preceded by a keyword or are not canonical are referred to as non-document comments that will not be parsed by Phpdoc and will not appear in the API text you produce.
3.2 How to write a document comment:
All of the documentation comments are a multiline comment starting with/**, called DocBlock in Phpdocumentor, and DocBlock is a software developer's help on a keyword that allows others to know what the keyword is for and how to use it. Phpdocumentor Specifies that a DocBlock contains the following information:
1. Function Summary Area
2. Detailed Description Area
3. Mark Tag
The first line of the document comment is the function description area, which is usually a concise description of the function of the class, method, or function , and the body of the function summary will be displayed in the index area in the generated document. The contents of the function description area can be either a blank line or a. To end
After the function description area is a blank line, followed by the detailed description area. This part of the main is to explain the functionality of your API, use, if possible, there can be examples of usage and so on. In this section, you should focus on the usual use of your API functions or methods, use them, and indicate whether they are cross-platform (if relevant), that you will be treated differently from the information that is common to the peace tables, and that the usual practice is to start another line and then write down the considerations on a particular platform or special information, this information should be sufficient so that your readers can write the appropriate test information, such as boundary conditions, parameter ranges, breakpoints, and so on.
After that is also a blank line, then the document tag tag, indicating some technical information, mainly the most important is the call parameter type, return value is extremely type, inheritance relationship, related methods/functions and so on.

Tags such as <b> <code> can also be used in document comments

5. Document Tags:
The use of a document tag is a keyword, or other document tag, that the tag can be used to decorate.
All document tags begin with a * after each line. If the mark of @ is out of the middle of a paragraph, the tag will be ignored as normal content.
6. Some annotation specifications
A. The comment must be
/**
* XXXXXXX
*/
The form
B. For a function that references a global variable, you must use the glboal tag.
C. For variables, the type must be marked with VAR (int,string,bool ... )
D. Functions must indicate their arguments and return values through the Param and return tags
E. For keywords that appear two or more times or more than two times, you need to ignore the excess by ingore and keep only one
F. Where other functions or classes are called, use link or other tags to link to the appropriate section for easy document reading.
G. Use non-document annotations where necessary to improve code legibility.
H. Descriptive content as concise as possible, using phrases rather than sentences.
I. Global variables, static variables and constants must be indicated by corresponding tags
1<?PHP2 /**3 * @name name4 * @abstract declaration variable/class/method5 * @access indicates access to this variable, class, function/method6 * @author function Author's name and email address7 * @category Organization Packages8 * @copyright Specify Copyright information9 * @const specified constantsTen * @deprecate indicates deprecated or deprecated information myeclipse encoding settings One * @example Example A * @exclude indicates that the current comment will not be analyzed and does not appear in the text block - * @final indicates that this is a final class, method, property, prohibit derivation, modification.  - * @global indicate the global variables referenced in this function the * @include indicate the information contained in the file - * @link define an online connection - * @module Define the module information for attribution - * @modulegroup module groups that define attribution + * @package Define the information of the packages that belong to - * @param define parameter information for a function or method + * @return Define the return information of a function or method A * @see define functions, variables to be referenced, and add the corresponding super connections.  at * @since indicates which version of the API function or method was introduced from - * @static indicates that variables, classes, functions are static.  - * @throws indicates an error that could be thrown by this function, which is extremely occurring - * @todo indicate areas that should be improved or not implemented - * @var Define description variables/properties.  - * @version define version information in */ - functionXXX ($a){..}

<?PHP/** * Sample file 2, phpdocumentor quickstart** This file demonstrates the rich information so can be included in* in-c Ode documentation through Docblocks and tags.* @author Greg Beaver <[email protected]>* @version 1.0* @package Sampl E*/  //PHP Code  /** * A sample function docblock* @global string Document The fact that this function uses $_myvar* @staticvar integer $s Taticvar This is actually returned* @param string $param 1 name to declare* @param string $param 2 value of the name * @return Integer*/functionFirstfunc ($param 1,$param 2= ' Optional ') {    Static $staticvar= 7; Global $_myvar; return $staticvar;}


  

Add a specification comment to the PHP code phpdocumentor

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.