Is there a correct way to signal an annotation parser to ignore an annotation inside of a docblock?

独自空忆成欢 提交于 2019-12-11 04:55:25

问题


Say I have a docblock comment that is parsed by, for example's sake, phpDocumentor and any annotation parser (let's say Doctrine common).

<?php
/**
 * @author Blah <blah@example.com>
 * Class to handle the generation of lorem ipsum text for our templates
 * To declare as a service in the DIC, __uncomment__ the following annotation
 * @DIC\Service("textgenerator.loremipsum")
 */
 class LipsumGenerator implements TextGeneratorInterface { }

Now, I don't want the @DIC\Service annotation to get parsed by default unless a user wants it parsed...obviously I could do any number things to prevent it: store it in a manual page instead of inline, put it in a non-docblock comment, etc.

Is there a correct and relatively standard way to signal an annotation parser, inline, to ignore an annotation inside of a docblock?


回答1:


Try the --ignore-tags arg -- http://manual.phpdoc.org/HTMLSmartyConverter/HandS/phpDocumentor/tutorial_phpDocumentor.howto.pkg.html#using.command-line.ignore-tags

If you want to make a "permanent list" of such annotations to be ignored, your best bet is a custom config file that you always use when running phpDocumentor. You can build a growing list of annotation tags to be ignored by all phpDocumentor runs that use the config file.

http://manual.phpdoc.org/HTMLSmartyConverter/HandS/phpDocumentor/tutorial_phpDocumentor.howto.pkg.html#using.config-files



来源:https://stackoverflow.com/questions/11745961/is-there-a-correct-way-to-signal-an-annotation-parser-to-ignore-an-annotation-in

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