How do I stop warnings in phpDocumentor parser when I inherit from an external library class?

a 夏天 提交于 2019-12-23 18:03:15

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/6339808/how-do-i-stop-warnings-in-phpdocumentor-parser-when-i-inherit-from-an-external-l

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!