13

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
}
Versha Gupta
  • 265
  • 2
  • 3
  • 10
  • have you tried adding php version to your file it will look like /* PHP 5 */ – vishwa Sep 08 '15 at 11:38
  • Can you give me example? I checked drupal standard module https://api.drupal.org/api/drupal/modules!comment!comment.module/7commenting and there is also an issue of missing file comment. May be this issue is of codesniffer? – Versha Gupta Sep 08 '15 at 12:08
  • i jsut read a blog http://blog.rajatpandit.com/2009/10/01/php-code-sniffer-and-common-errors/ – vishwa Sep 08 '15 at 12:15
  • Added PHP version 5 but still got the issue – Versha Gupta Sep 08 '15 at 12:54

1 Answers1

14

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.

SebCorbin
  • 1,645
  • 1
  • 12
  • 23