You are here

protected function Drupal_Sniffs_Commenting_FunctionCommentSniff::processThrows in Coder 7.2

Process any throw tags that this function comment has.

Parameters

int $commentStart The position in the stack where the: comment started.

Return value

void

1 call to Drupal_Sniffs_Commenting_FunctionCommentSniff::processThrows()
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 312

Class

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

Code

protected function processThrows($commentStart) {
  if (count($this->commentParser
    ->getThrows()) === 0) {
    return;
  }
  foreach ($this->commentParser
    ->getThrows() as $throw) {
    $exception = $throw
      ->getValue();
    $errorPos = $commentStart + $throw
      ->getLine();
    if ($exception === '') {
      $error = '@throws tag must contain the exception class name';
      $this->currentFile
        ->addError($error, $errorPos, 'EmptyThrows');
    }
  }
}