Search code examples
phpphpdoc

Are custom tags possible in phpDoc?


Does phpDoc support custom tags? I would like to use @untested to mark code that hasn't been tested yet. How can this be done?


Solution

  • Why don't you just use the @todo tag like

     /**
      * Here comes the summary
      *
      * @todo this code has to be tested
      *
      * @return boolean Returns something
      */
     function someFunction()
     {
         <...>
     }
    

    Or if you don't want this information to be included in your documentation, you could use the inline @internal tag like this:

     /**
      * Here comes the summary
      *
      * {@internal this code has to be tested }}
      *
      * @return boolean Returns something
      */
     function someFunction()
     {
         <...>
     }
    

    I don't think it is a good idea to add custom tags. Although PHPDoc is still informal, it is likely that it will become a formal standard in the near future. So if I were you, I'd stick with official tags whenever possible.