comparison vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Commenting/PostStatementCommentSniff.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
1 <?php 1 <?php
2 /** 2 /**
3 * Drupal_Sniffs_Commenting_PostStatementCommentSniff. 3 * \Drupal\Sniffs\Commenting\PostStatementCommentSniff.
4 * 4 *
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 * Largely copied from Squiz_Sniffs_Commenting_PostStatementCommentSniff but we want 16 * Largely copied from
12 * the fixer to move the comment to the previous line. 17 * \PHP_CodeSniffer\Standards\Squiz\Sniffs\Commenting\PostStatementCommentSniff
18 * but we want the fixer to move the comment to the previous line.
13 * 19 *
14 * @category PHP 20 * @category PHP
15 * @package PHP_CodeSniffer 21 * @package PHP_CodeSniffer
16 * @link http://pear.php.net/package/PHP_CodeSniffer 22 * @link http://pear.php.net/package/PHP_CodeSniffer
17 */ 23 */
18 class Drupal_Sniffs_Commenting_PostStatementCommentSniff implements PHP_CodeSniffer_Sniff 24 class PostStatementCommentSniff implements Sniff
19 { 25 {
20 26
21 /** 27 /**
22 * A list of tokenizers this sniff supports. 28 * A list of tokenizers this sniff supports.
23 * 29 *
39 45
40 46
41 /** 47 /**
42 * Processes this sniff, when one of its tokens is encountered. 48 * Processes this sniff, when one of its tokens is encountered.
43 * 49 *
44 * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. 50 * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
45 * @param int $stackPtr The position of the current token in the 51 * @param int $stackPtr The position of the current token in the
46 * stack passed in $tokens. 52 * stack passed in $tokens.
47 * 53 *
48 * @return void 54 * @return void
49 */ 55 */
50 public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) 56 public function process(File $phpcsFile, $stackPtr)
51 { 57 {
52 $tokens = $phpcsFile->getTokens(); 58 $tokens = $phpcsFile->getTokens();
53 59
54 if (substr($tokens[$stackPtr]['content'], 0, 2) !== '//') { 60 if (substr($tokens[$stackPtr]['content'], 0, 2) !== '//') {
55 return; 61 return;