Changeset 1375

Show
Ignore:
Timestamp:
02/26/08 14:44:51 (11 months ago)
Author:
richi
Message:

defect #127: fixed issues with "// @codeCoverageIgnoreStart"

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/main/php/org/stubbles/codeSniffer/Stubbles/Sniffs/Commenting/stubFunctionCommentSniff.php

    r1309 r1375  
    107107        // If the token that we found was a class or a function, then this 
    108108        // function has no doc comment. 
    109         $code = $tokens[$commentEnd]['code']; 
    110  
    111         if ($code === T_COMMENT) { 
    112             $error = 'You must use "/**" style comments for a function comment'; 
    113             $phpcsFile->addError($error, $stackPtr); 
    114             return; 
    115         } else if ($code !== T_DOC_COMMENT) { 
    116             $phpcsFile->addError('Missing function doc comment', $stackPtr); 
    117             return; 
     109        $code    = $tokens[$commentEnd]['code']; 
     110        $content = $tokens[$commentEnd]['content']; 
     111 
     112        /* 
     113         * Stubbles (ignore code coverage comments) 
     114         */ 
     115        if (rtrim($content)  !== '// @codeCoverageIgnoreStart') { 
     116            if ($code === T_COMMENT) { 
     117                $error = 'You must use "/**" style comments for a function comment'; 
     118                $phpcsFile->addError($error, $stackPtr); 
     119                return; 
     120            } else if ($code !== T_DOC_COMMENT) { 
     121                $phpcsFile->addError('Missing function doc comment', $stackPtr); 
     122                return; 
     123            } 
    118124        } 
    119125