Add a specification comment to the PHP code phpdocumentor

Source: Internet
Author: User
Tags deprecated

Add a specification comment to the PHP code
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 document comments are a multiline comment that starts with/**, called DocBlock in Phpdocumentor, and DocBlock is a software developer's help on a keyword that enables others to know the specific purpose of the keyword. 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 a detailed description area. This section is mainly about the function of your API, the 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 
<?php/*** @name name * @abstract DECLARE variable/class/method * @access indicate access rights for this variable, class, Function/method * @author function Author's name and email address * @category  organization Packages * @copyright Specify the Copyright information * @const Specify constants * @deprecate indicate deprecated or deprecated information myeclipse encoding settings * @example Example * @exclude indicates that the current comment will not be parsed and does not appear in the text block * @fi NAL indicates that this is a final class, method, property, prohibit derivation, modification.  * @global indicate the global variable referenced in this function * @include indicate the information contained in the file * @link define an online connection * @module define the module information for attribution * @modulegroup define the attribution of the module group * @package Define the ownership of the package information * @param define the parameter information for a function or method * @return Define the return information of a function or method * @see define the function, variable, and add the corresponding super-connection. * @since indicates which version of the API function or method was introduced from * @static indicates that variables, classes, functions are static. * @throws indicate the error exception that may be thrown by this function, the very occurrence of the condition * @todo indicate where it should be improved or not implemented * @var define the description variable/property. * @version define version information */function XXX ($a) {:}

  

<?php/*** Sample file 2, phpdocumentor quickstart** This file demonstrates the rich information so can be included in  * In-code documentation through Docblocks and tags.* @author Greg Beaver <[email protected]>* @version 1.0* @package sample*///php Code/*** A Sample function docblock* @global string Document The fact that this function uses $_myvar* @s Taticvar integer $staticvar This is actually returned* @param string $param 1 name to declare* @param string $param 2 value of the name* @return integer*/function firstfunc ($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.