comparison vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Commenting/DocCommentSniff.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 4c8ae668cc8c
children
comparison
equal deleted inserted replaced
16:c2387f117808 17:129ea1e6d783
5 * @category PHP 5 * @category PHP
6 * @package PHP_CodeSniffer 6 * @package PHP_CodeSniffer
7 * @link http://pear.php.net/package/PHP_CodeSniffer 7 * @link http://pear.php.net/package/PHP_CodeSniffer
8 */ 8 */
9 9
10 namespace Drupal\Sniffs\Commenting;
11
12 use PHP_CodeSniffer\Files\File;
13 use PHP_CodeSniffer\Sniffs\Sniff;
14
10 /** 15 /**
11 * Ensures doc blocks follow basic formatting. 16 * Ensures doc blocks follow basic formatting.
12 * 17 *
13 * Largely copied from Generic_Sniffs_Commenting_DocCommentSniff, but Drupal @file 18 * Largely copied from
14 * comments are different. 19 * \PHP_CodeSniffer\Standards\Generic\Sniffs\Commenting\DocCommentSniff,
20 * but Drupal @file comments are different.
15 * 21 *
16 * @category PHP 22 * @category PHP
17 * @package PHP_CodeSniffer 23 * @package PHP_CodeSniffer
18 * @link http://pear.php.net/package/PHP_CodeSniffer 24 * @link http://pear.php.net/package/PHP_CodeSniffer
19 */ 25 */
20 class Drupal_Sniffs_Commenting_DocCommentSniff implements PHP_CodeSniffer_Sniff 26 class DocCommentSniff implements Sniff
21 { 27 {
22 28
23 /** 29 /**
24 * A list of tokenizers this sniff supports. 30 * A list of tokenizers this sniff supports.
25 * 31 *
44 50
45 51
46 /** 52 /**
47 * Processes this test, when one of its tokens is encountered. 53 * Processes this test, when one of its tokens is encountered.
48 * 54 *
49 * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. 55 * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
50 * @param int $stackPtr The position of the current token 56 * @param int $stackPtr The position of the current token
51 * in the stack passed in $tokens. 57 * in the stack passed in $tokens.
52 * 58 *
53 * @return void 59 * @return void
54 */ 60 */
55 public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) 61 public function process(File $phpcsFile, $stackPtr)
56 { 62 {
57 $tokens = $phpcsFile->getTokens(); 63 $tokens = $phpcsFile->getTokens();
58 $commentEnd = $phpcsFile->findNext(T_DOC_COMMENT_CLOSE_TAG, ($stackPtr + 1)); 64 $commentEnd = $phpcsFile->findNext(T_DOC_COMMENT_CLOSE_TAG, ($stackPtr + 1));
59 $commentStart = $tokens[$commentEnd]['comment_opener']; 65 $commentStart = $tokens[$commentEnd]['comment_opener'];
60 66