3
* Squiz_Sniffs_Classes_LowercaseClassKeywordsSniff.
8
* @package PHP_CodeSniffer
9
* @author Greg Sherwood <gsherwood@squiz.net>
10
* @author Marc McIntyre <mmcintyre@squiz.net>
11
* @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600)
12
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
13
* @link http://pear.php.net/package/PHP_CodeSniffer
17
* Squiz_Sniffs_Classes_LowercaseClassKeywordsSniff.
19
* Ensures all class keywords are lowercase.
22
* @package PHP_CodeSniffer
23
* @author Greg Sherwood <gsherwood@squiz.net>
24
* @author Marc McIntyre <mmcintyre@squiz.net>
25
* @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600)
26
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
27
* @version Release: 1.5.5
28
* @link http://pear.php.net/package/PHP_CodeSniffer
30
class Squiz_Sniffs_Classes_LowercaseClassKeywordsSniff implements PHP_CodeSniffer_Sniff
35
* Returns an array of tokens this test wants to listen for.
39
public function register()
57
* Processes this test, when one of its tokens is encountered.
59
* @param PHP_CodeSniffer_File $phpcsFile The file being scanned.
60
* @param int $stackPtr The position of the current token in
61
* the stack passed in $tokens.
65
public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
67
$tokens = $phpcsFile->getTokens();
69
$content = $tokens[$stackPtr]['content'];
70
if ($content !== strtolower($content)) {
71
$error = '%s keyword must be lowercase; expected "%s" but found "%s"';
77
$phpcsFile->addError($error, $stackPtr, 'FoundUppercase', $data);