public function AuthorTagSniff::process in Coder 8.3.x
Same name and namespace in other branches
- 8.3 coder_sniffer/DrupalPractice/Sniffs/Commenting/AuthorTagSniff.php \DrupalPractice\Sniffs\Commenting\AuthorTagSniff::process()
- 8.2 coder_sniffer/DrupalPractice/Sniffs/Commenting/AuthorTagSniff.php \DrupalPractice\Sniffs\Commenting\AuthorTagSniff::process()
Processes this test, when one of its tokens is encountered.
Parameters
\PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.:
int $stackPtr The position of the current token: in the stack passed in $tokens.
Return value
void
File
- coder_sniffer/
DrupalPractice/ Sniffs/ Commenting/ AuthorTagSniff.php, line 47
Class
- AuthorTagSniff
- Checks the usage of @author tags.
Namespace
DrupalPractice\Sniffs\CommentingCode
public function process(File $phpcsFile, $stackPtr) {
$tokens = $phpcsFile
->getTokens();
$content = $tokens[$stackPtr]['content'];
if ($content === '@author' || $content === '@author:') {
$warning = '@author tags are not usually used in Drupal, because over time multiple contributors will touch the code anyway';
$phpcsFile
->addWarning($warning, $stackPtr, 'AuthorFound');
}
}