The PHP function documentation convention requires that the function author description include the author's name/username, contact information (optional), and copyright information (if applicable). Examples are as follows: Function author name: John Doe Contact information: johndoe@example.com Copyright information: 2023
PHP Function Document Writing Specification: Function Author Description Requirements
Introduction
PHP function documentation is an important resource for developers to understand and use the functions in the library. Clear and comprehensive documentation can significantly improve development efficiency and code understandability. This guide describes the requirements for function author descriptions in the PHP Function Documentation Specification.
Requirements
The function author description should contain the following information:
Example
/** * 将日期转换为 Unix 时间戳 * * @param string $date 日期,格式为 Y-m-d H:i:s * @return int Unix 时间戳 * * @author John Doe * @contact johndoe@example.com * @copyright 2023 */ function to_timestamp(string $date): int { // ... }
Practice case
Consider the following function document:
/** * 比较两个字符串 * * @param string $str1 第一个字符串 * @param string $str2 第二个字符串 * @return int 比较结果(-1、0 或 1) */ function compare_strings(string $str1, string $str2): int { // ... }
According to the writing specification, we can add author description information:
/** * 比较两个字符串 * * @param string $str1 第一个字符串 * @param string $str2 第二个字符串 * @return int 比较结果(-1、0 或 1) * * @author Jane Doe * @contact janedoe@example.com */ function compare_strings(string $str1, string $str2): int { // ... }
Notes
The above is the detailed content of What are the description requirements for function authors in the PHP function documentation specification?. For more information, please follow other related articles on the PHP Chinese website!