You are here

protected function Drupal_Sniffs_Commenting_FunctionCommentSniff::processSees in Coder 7.2

Process the function "see" comments.

Return value

void

1 call to Drupal_Sniffs_Commenting_FunctionCommentSniff::processSees()
Drupal_Sniffs_Commenting_FunctionCommentSniff::process in coder_sniffer/Drupal/Sniffs/Commenting/FunctionCommentSniff.php
Processes this test, when one of its tokens is encountered.

File

coder_sniffer/Drupal/Sniffs/Commenting/FunctionCommentSniff.php, line 566

Class

Drupal_Sniffs_Commenting_FunctionCommentSniff
Parses and verifies the doc comments for functions. Largely copied from Squiz_Sniffs_Commenting_FunctionCommentSniff.

Code

protected function processSees($commentStart) {
  $sees = $this->commentParser
    ->getSees();
  foreach ($sees as $see) {
    $errorPos = $see
      ->getLine() + $commentStart;
    if ($see
      ->getWhitespaceBeforeContent() !== ' ') {
      $error = 'Expected 1 space before see reference';
      $this->currentFile
        ->addError($error, $errorPos, 'SpacingBeforeSee');
    }
    $comment = trim($see
      ->getContent());
    if (strpos($comment, ' ') !== false) {
      $error = 'The @see reference should not contain any additional text';
      $this->currentFile
        ->addError($error, $errorPos, 'SeeAdditionalText');
      continue;
    }
    if (preg_match('/[\\.!\\?]$/', $comment) === 1) {
      $error = 'Trailing punctuation for @see references is not allowed.';
      $this->currentFile
        ->addError($error, $errorPos, 'SeePunctuation');
    }
  }
}