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(/* ... */);
}
以上是 PHP 向功能添加元数据 的全部内容, 来源链接: utcz.com/z/320379.html