0

我应该如何使用 doxygen 或 phpdocumentor 标记来记录 final_nums 常量?关闭在较旧的 phpdocumentor 中无法记录,但从 phpdocumentor2 开始,它们应该具有完整的 php 5.3 支持。为了使文档更复杂一点,通过取消引用,闭包是短暂的。

我相信生成的文档应该解释该常量由匿名函数的结果组成,该函数接受(int)前缀和(字符串)输入的争论并返回(int)结果。

$prefix = 1234;
$input = $_GET['input'];
define( 'final_nums', call_user_func(function() use ( $prefix, $input ) {       
    $no_str = preg_replace( '/[^0-9]/', '', $input );
    $output = $prefix . $no_str;
    return $output;
}));
4

1 回答 1

0

/** * A constant that is generated based on $prefix and $input at runtime * @var int * @see $prefix * @see $input */ define( ... ); 用于实现的闭包对我来说似乎无关紧要,读者,如果我关心的是常量是什么。

如果/当@type标签被实现时,它将是@var表示数据类型的更好选择。

于 2014-05-27T21:54:18.993 回答