当我从外部库类继承时,如何在phpDocumentor解析器中停止警告? [英] How do I stop warnings in phpDocumentor parser when I inherit from an external library class?

查看:135
本文介绍了当我从外部库类继承时,如何在phpDocumentor解析器中停止警告?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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



然而,在我当前的文档编译中,我有一个最后一个'class'的警告 - 我收到了一个在我的应用程序中记录的继承自外部库(在本例中是Zend)的类的警告。 p>

有没有办法停止警告,例如警告 - 类AMH_Controller_Action父Zend_Controller_Action未找到发生?如何通知phpDoc父对象来自外部库,并可能给出Zend文档的参考链接?

解决方案

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



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



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

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

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

现在,关于你的文档的东西,如果你的类确实扩展了ZF类。没有phpDocumentor解析这些ZF源,你的类的API文档将不会显示从这些ZF父系继承的方法等。如果这是我的代码库,我将允许phpDocumentor来解析ZF文件,但是避免在运行时列出其固有的@package值(例如Zend_Controller)的不是记录的ZF类, -packageoutput参数。



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


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?

解决方案

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

这篇关于当我从外部库类继承时,如何在phpDocumentor解析器中停止警告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆