comparison vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/CSS/ColourDefinitionSniff.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_CSS_ColourDefinitionSniff. 3 * \Drupal\Sniffs\CSS\ColourDefinitionSniff.
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\CSS;
11
12 use PHP_CodeSniffer\Files\File;
13 use PHP_CodeSniffer\Sniffs\Sniff;
14
10 /** 15 /**
11 * Squiz_Sniffs_CSS_ColourDefinitionSniff. 16 * \Drupal\Sniffs\CSS\ColourDefinitionSniff.
12 * 17 *
13 * Ensure colours are defined in lower-case. 18 * Ensure colours are defined in lower-case.
14 * 19 *
15 * @category PHP 20 * @category PHP
16 * @package PHP_CodeSniffer 21 * @package PHP_CodeSniffer
17 * @link http://pear.php.net/package/PHP_CodeSniffer 22 * @link http://pear.php.net/package/PHP_CodeSniffer
18 */ 23 */
19 class Drupal_Sniffs_CSS_ColourDefinitionSniff implements PHP_CodeSniffer_Sniff 24 class ColourDefinitionSniff implements Sniff
20 { 25 {
21 26
22 /** 27 /**
23 * A list of tokenizers this sniff supports. 28 * A list of tokenizers this sniff supports.
24 * 29 *
40 45
41 46
42 /** 47 /**
43 * Processes the tokens that this sniff is interested in. 48 * Processes the tokens that this sniff is interested in.
44 * 49 *
45 * @param PHP_CodeSniffer_File $phpcsFile The file where the token was found. 50 * @param \PHP_CodeSniffer\Files\File $phpcsFile The file where the token was found.
46 * @param int $stackPtr The position in the stack where 51 * @param int $stackPtr The position in the stack where
47 * the token was found. 52 * the token was found.
48 * 53 *
49 * @return void 54 * @return void
50 */ 55 */
51 public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) 56 public function process(File $phpcsFile, $stackPtr)
52 { 57 {
53 $tokens = $phpcsFile->getTokens(); 58 $tokens = $phpcsFile->getTokens();
54 $colour = $tokens[$stackPtr]['content']; 59 $colour = $tokens[$stackPtr]['content'];
55 60
56 $expected = strtolower($colour); 61 $expected = strtolower($colour);