Search code examples
phpphpdoc

How to paste special symbols in PHPDocumentor block in PHP like "*/"?


How to paste similar symbols into PHPDoc block?

  • */
  • @

E.g.:

/**
 * Please use these symbol "@" with symbols "*/" as well.
 */

Could not find it in documentation.


Solution

  • From the phpdoc.org manual we can read:

    if you need an actual "@" in your DocBlock's description parts, you should be careful to either ensure it is not the first character on a line, or else escape it ("\@")

    Also New 1.2.0rc1:

    If you need to use the closing comment "*/" in a DocBlock, use the special escape sequence "{@*}."

    /**
     * <code>
     * \@require 'config.php'
     * Example comment {@*}
     * </code>
     */
    

    Will be rendered as:

    /**
     * <code>
     * @require 'config.php'
     * Example comment */
     * </code>
     */