问题
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