脚本宝典收集整理的这篇文章主要介绍了PHPDocumentor可选参数,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
/** * daysBetween * * Returns the number of whole working days between start_date and end_date. Working * days exclude weekends and any dates identified in holidays. * Use NETWORKDAYS to calculate employee benefITs that accrue based on the number of * days worked during a sPEcific term. * * @param DateTime $startDate Start date * @param DateTime $endDate End date * @param DateTime $holidays,... Optional series of dates that will be excluded * @return integer Interval between the dates */ public function daysBetween($startDate,$endDate) { // Shift the mandatory start and end date that are referenced // in the function deFinition,to get any optional days $holidays = func_get_args(); array_shift($holidays); array_shift($holidays);
$startDate和$endDate是必需参数,而$holidays的所有实例都是可选的……可能没有定义,一个或多个$holiday日期.上面的PHPDocumentor定义给了我
public function daysBetween($startDate,$endDate,$holidays=NULL) {
但这感觉非常糟糕,我不相信我必须改变我的功能定义才能记录它.有人有任何其他建议吗?
附:我正在使用PHPDocumentor2
* @param DateTime $holidays,... Optional series of dates that will be excluded
根据param标签[1]的PHPDocumentor手册看起来是正确的.此页面显示“$holidays,…”语法应该足以让PHPDocumentor识别一个不直接出现在代码方法签名中的可选参数.
这个“参数$holidays,…在daysBetween()中找不到”,响应可能需要在github页面打开一个新问题[2].
[1] – http://manual.phpdoc.org/HTMLSmartyConverter/HandS/phpDocumentor/tutorial_tags.param.pkg.html
[2] – https://github.com/phpDocumentor/phpDocumentor2/issues/424
以上是脚本宝典为你收集整理的PHPDocumentor可选参数全部内容,希望文章能够帮你解决PHPDocumentor可选参数所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。