PHP 文档:声明您正在返回另一个函数调用的结果



使用这样的函数:

function cancel($thing_id)
{
   $this->Thing->id = $thing_id;
   return $this->Thing->cancel();
}

如何格式化@return以反映我正在返回另一个函数调用的结果?

无法

将返回类型链接到不同的函数返回类型。在phpDocumentor:定义一个"类型"中没有提到它是一个类型,最接近的是callable类型。

你能做的最好的事情可能是:

/**
 * As a example I have assumed that $this->Thing->cancel() returns either true or false
 *
 * @see Thing::cancel
 * @return bool Returns the result of Thing::cancel
 */

如您所见,我指定了$this->Thing->cancel()的返回类型,并解释了返回类型的来源。为了便于找到该方法,我添加了@see标记,指向该方法

最新更新