关于 php:PHPDocumentor – 我的 DocBlock 出了什么问题? | 珊瑚贝

PHPDocumentor – what’s wrong with my DocBlock?


我在一些遗留代码中添加了一些注释,我遇到了 PHPDocumentor 的一个小问题。

这是一个例子:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/**
 * Constructs the Widget object
 *
 * Basic constructor for the widget object.
 * Another line of pointless explanation, badly worded.
 *
 * @param  string   $id    The ID of the widget
 * @param  int      $size  The Size of the widget
 * @throws InvalidArgumentException
 */

public function __construct($id, $size) {
    if (!is_string($id) || !is_integer($size)) {
        throw new InvalidArgumentException(‘$id must be a string, $size an integer’);
    }
    $this->id = $id;
    $this->size = $size;
}

我从命令行运行 PHPDocumentor,并得到一个充满文档的可爱文件夹。

文档看起来不错,但我收到 PHPDocumentor 编译错误,如下所示:

1
Argument $id is missing from the Docblock of __construct

这只是 PHPDocumenator 不必要的抱怨,还是我明显遗漏了什么?

  • 你确定它指向那个文件吗?
  • 是的!文档本身看起来很完整,但它仍然在 errors.html 文件中抛出错误。
  • 是否可以在另一个非 ASCII 键盘布局中输入任何字母?
  • __construct 不返回,所以不应该有 @return void 。只是一个挑剔:)
  • 接得好。阿波利斯。


phpDocumentor 2.8.1 版也有同样的问题。看来这是这个版本的一个错误:
在此处输入链接描述

我用的是2.7.0版本,现在可以了。

  • Ehsan 的链接将带您了解未修补问题的说明,该问题可以通过构建来修复,并从 GitHub 源进行修补。希望它会在 3.0 中修复。


来源:https://www.codenong.com/26664805/

微信公众号
手机浏览(小程序)
0
分享到:
没有账号? 忘记密码?