Search code examples
drupalphpcodesniffer

Missing file doc comment?


I used drupal coder module to check my code and always get missing file doc as an error. I used the following file doc comment but still showing error. Can you please guide me what am i doing wrong. Edit:

 <?php

/**
 * @file
 * Description
 */


/**
 * Implements hook_menu().
 *
 * Description
 *
 * @return array An array of menu items
 */
function hook_menu() {
 //My code
}

Solution

  • Typical first 15 lines of a file:

    <?php
    
    /**
     * @file
     * Description of what this module (or file) is doing.
     */
    
    /**
     * Implements hook_help().
     */
    function yourmodule_help($path, $arg) {
      // or any other hook...
    }
    

    Don't forget to also comment the first function of you file with /** or else coder will believe that your @file comment is your first function's comment.