phpphpdocphpdocumentor2

Would it make a difference to PHPdoc if I close my tags with colon (example)?


I always use colons in my phpdoc blocs. For example, instead of:

/** Some comment
 *
 *@private
 * 
 *@param string $sTable The name of the table 
 *@return bool True otherwise void
 *@example className->tableExists($sTable);
 *@since date
 */

Instead of the above, I use the following style:

/** Some comment
 *
 * @private
 * 
 * @param   : string $sTable The name of the table 
 * @return  : bool True otherwise void
 * @example : className->tableExists($sTable);
 * @since   : date
 */

You see, I prefer to divide the tags and description with colons. It's easier to read and has more style. But I wonder if this makes any difference for PHPdoc parsing the docbloc at all?


Solution

  • To PHPDocumentor it makes quite a difference. Testing shows the following

    /**
     * Test constructor.
     * @param : string $var testvar
     *
     */
    

    gets documented to: enter image description here

    Where

    /**
     * Test constructor.
     * @param  string $var testvar
     *
     */
    

    outputs enter image description here

    It is ofcourse somewhat logical that it is that way, as it is a syntax error. If you want to make the docblock look nice, you can align the values with spaces.

    /** Some comment
     *
     *@private
     *
     *@param   string $sTable The name of the table
     *@return  bool|void      True otherwise void
     *@example className->tableExists($sTable);
     *@since   date
     */