我有一个函数,它使用作为引用传递的属性:
public function doSomething(&$argumentPassedByReference)
{
// ...
}
我维护我项目的 PHPDoc,所以我这样描述我的函数:
/**
* Do something very useful with the thing passed in parameters
*
* @param Type $argumentPassedByReference Thing that will be edited
*/
public function doSomething(&$argumentPassedByReference)
但我不是很满意,因为它没有显示 $argumentPassedByReference
是通过引用传递的。 PHPDoc 中是否有一个标准来描述这一点?
最佳答案
在函数定义中添加 & 符号:
/**
* Do something very useful with the thing passed in parameters
*
* @param Type &$argumentPassedByReference Thing that will be edited
*/
关于php - 是否有 PHPDoc 标准来描述通过引用传递的函数属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62934920/