I've corrected all the other problems reported by `phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme template.php` and the last two look like a bug to me. This code:
function k2tech_preprocess_page(&$variables) {
if (isset($variables['node'])) {
$variables['theme_hook_suggestions'][] = 'page__' . $variables['node']->type;
}
}
function zen_id_safe($string) {
if (is_numeric($string{0})) {
// If the first character is numeric, add 'n' in front.
$string = 'n' . $string;
}
return strtolower(preg_replace('/[^a-zA-Z0-9_-]+/', '-', $string));
}
Results in this report:
FILE: template.php
--------------------------------------------------------------------------------
FOUND 2 ERROR(S) AFFECTING 2 LINE(S)
--------------------------------------------------------------------------------
102 | ERROR | You must use "/**" style comments for a function comment
108 | ERROR | Missing function doc comment
--------------------------------------------------------------------------------
It seems to me that both functions should have the "Missing function doc comment" error.
Comments
Comment #1
klausiThe snippet from above works correctly for me and throws the "Missing function doc comment" twice. Is there any other comment before the first function? Did you try with the latest release of drupalcs?
Comment #2
thsutton commentedIt's interpretting a // comment inside the previous function as a "wrong style" of doc comments. I've attached a file which demonstrates the problem with the current release and (though I may be testing incorrectly) the current dev release.
Comment #3
thsutton commentedComment #4
klausiFixed: http://drupalcode.org/project/drupalcs.git/commit/3fab93a