PHP 向功能添加元数据
示例
功能级别注释可帮助IDE识别返回值或潜在危险的代码
/**
* Adds two numbers together.
*
* @param Int $a First parameter to add
* @param Int $b Second parameter to add
* @return Int
*/
function sum($a, $b)
{
return (int) $a + $b;
}
/**
* Don't run me! I will always raise an exception.
*
* @throws Exception Always
*/
function dangerousCode()
{
throw new Exception('Ouch, that was dangerous!');
}
/**
* Old structures should be deprecated so people know not to use them.
*
* @deprecated
*/
function oldCode()
{
mysql_connect(/* ... */);
}
热门推荐
10 领证结婚搞笑祝福语简短
11 郭可盈老公生日祝福语简短
12 恭喜公司发展祝福语简短
13 疫情高考父母祝福语简短
14 闰年感人婚礼祝福语简短
15 开业服装贺卡祝福语简短
16 酒店求婚文案祝福语简短
17 考取名校祝福语简短
18 公司团建周年祝福语简短