当我从外部库类继承时,如何停止 phpDocumentor 解析器中的警告?

发布于 2024-11-15 07:36:19 字数 309 浏览 3 评论 0原文

我一直在代码中添加docblocks,并解决了phpDocumentor 脚本生成并放入errors.html 文件中的大部分构建错误和警告。

然而,我当前的文档构建中还有最后一类警告 - 对于我在应用程序中记录的从外部库(在本例中为 Zend)继承的每个类,我都会收到警告。

有没有办法阻止诸如 Warning - Class AMH_Controller_Actionparent Zend_Controller_Action notfound 之类的警告发生?我如何通知 phpDoc 父级来自外部库,并可能提供 Zend 文档的参考链接?

I've been adding docblocks to my code, and have resolved most of the build errors and warnings that the phpDocumentor script has generated and placed into the errors.html file.

However, I have one last 'class' of warnings in my current documentation build - I get a warning for every class that I have documented in my application that inherits from an external library (in this case, Zend).

Is there a way to stop warnings such as Warning - Class AMH_Controller_Action parent Zend_Controller_Action not found from occuring? How do I inform phpDoc that the parent is from an external library and possibly give a reference link to the Zend documentation?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

暖阳 2024-11-22 07:36:19

phpDocumentor 本身没有本地选项来处理此用例。我过去所做的是创建一个虚拟文件,其中包含所有“未找到”类的空类声明,将这些类标记为“@package DoNotDocument”,并使用运行时 --packageoutput 参数 [1] 没有在要包含在输出文档中的包列表中列出“DoNotDocument”。诚然,这是一个 hack,但效果是:

a)避免“未找到”警告(因为类现在“存在”),

而 b)不为虚拟类创建任何文档。

/**
 * @package DoNotDocument
 */
class Zend_Controller_Action {}

phpdoc -d ./src -t ./docs -po MyPackage1,MyPackage2

现在,如果您的类确实扩展了 ZF 类,那么关于您的文档需要考虑一些事情。如果不让 phpDocumentor 解析这些 ZF 源,您的类的 API 文档将不会显示从这些 ZF 父级继承的方法等。如果这是我的代码库,我将允许 phpDocumentor 解析 ZF 文件,但会避免通过 not 在运行时列出其固有的 @package 值(例如“Zend_Controller”)来记录 ZF 类 - -packageoutput 参数。

[1] -- http://manual.phpdoc.org/HTMLSmartyConverter/HandS/phpDocumentor/tutorial_phpDocumentor.howto.pkg.html#using.command-line.packageoutput

phpDocumentor itself does not have a native option to handle this use case. What I've done in the past has been to create a dummy file that contains empty class declarations for all the "not found" classes, tagged these classes like "@package DoNotDocument", and used the runtime --packageoutput argument [1] without listing "DoNotDocument" in the list of packages to include in the output documents. Granted, this is a hack, but the effect is to:

a) avoid "not found" warnings (because class now "exists"),

while b) not creating any docs for the dummy classes.

/**
 * @package DoNotDocument
 */
class Zend_Controller_Action {}

phpdoc -d ./src -t ./docs -po MyPackage1,MyPackage2

Now, something to ponder regarding your docs, if your classes do indeed extend ZF classes. By not having phpDocumentor parse those ZF sources, your API docs for your classes will not show what methods etc that are inherited from those ZF parents. If this was my code base, I would allow phpDocumentor to parse the ZF files, but would avoid having the ZF classes documented by not listing their inherent @package value (e.g. "Zend_Controller") in the runtime --packageoutput argument.

[1] -- http://manual.phpdoc.org/HTMLSmartyConverter/HandS/phpDocumentor/tutorial_phpDocumentor.howto.pkg.html#using.command-line.packageoutput

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文