function _coder_review_comment_missing_docblock in Coder 7.2
Rule callback: Checks for missing docblocks.
See also
1 string reference to '_coder_review_comment_missing_docblock'
- coder_review_comment_reviews in coder_review/
includes/ coder_review_comment.inc - Implements hook_reviews().
File
- coder_review/
includes/ coder_review_comment.inc, line 255 - This include file implements coder functionality for comments.
Code
function _coder_review_comment_missing_docblock(array &$coder_args, array $review, array $rule, array $lines, array &$results) {
// Setup variable to display warnings.
$severity_name = _coder_review_severity_name($coder_args, $review, $rule);
$tmprule = $rule;
// Look for where all the classes and functions start.
$alllines = $coder_args['#all_array_lines'];
$prev_stack = array(
'',
'',
);
foreach ($coder_args['#stack'] as $lineno => $current_stack) {
$anchor = NULL;
if ($current_stack[0] && $current_stack[0] != $prev_stack[0]) {
if (!isset($alllines[$lineno - 1]) || substr($alllines[$lineno - 1][0], -2) != '*/') {
$anchor = 'classes';
}
}
elseif ($current_stack[1] && $current_stack[1] != $prev_stack[1]) {
if (!isset($alllines[$lineno - 1]) || substr($alllines[$lineno - 1][0], -2) != '*/') {
$anchor = $current_stack[0] ? 'classes' : 'functions';
}
}
if ($anchor) {
$tmprule['#warning'] = array(
'#text' => "Docblock should be immediately above @ref",
'#args' => array(
'@ref' => implode('::', array_filter($current_stack)),
),
'#link' => _drupalnode(1354, $anchor),
);
_coder_review_error($results, $tmprule, $severity_name, $lineno, $alllines[$lineno][0], $coder_args['#ignores']);
}
$prev_stack = $current_stack;
}
}