当我从外部库类继承时,如何停止 phpDocumentor 解析器中的警告?
我一直在代码中添加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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
phpDocumentor 本身没有本地选项来处理此用例。我过去所做的是创建一个虚拟文件,其中包含所有“未找到”类的空类声明,将这些类标记为“@package DoNotDocument”,并使用运行时 --packageoutput 参数 [1] 没有在要包含在输出文档中的包列表中列出“DoNotDocument”。诚然,这是一个 hack,但效果是:
a)避免“未找到”警告(因为类现在“存在”),
而 b)不为虚拟类创建任何文档。
现在,如果您的类确实扩展了 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.
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