function EmptyStyleDefinitionSniff::process
Processes the tokens that this sniff is interested in.
Parameters
\PHP_CodeSniffer\Files\File $phpcsFile The file where the token was found.:
int $stackPtr The position in the stack where: the token was found.
Return value
void
Overrides Sniff::process
File
-
vendor/
squizlabs/ php_codesniffer/ src/ Standards/ Squiz/ Sniffs/ CSS/ EmptyStyleDefinitionSniff.php, line 50
Class
Namespace
PHP_CodeSniffer\Standards\Squiz\Sniffs\CSSCode
public function process(File $phpcsFile, $stackPtr) {
$tokens = $phpcsFile->getTokens();
$ignore = Tokens::$emptyTokens;
$ignore[] = T_COLON;
$next = $phpcsFile->findNext($ignore, $stackPtr + 1, null, true);
if ($next === false || $tokens[$next]['code'] === T_SEMICOLON || $tokens[$next]['line'] !== $tokens[$stackPtr]['line']) {
$error = 'Style definition is empty';
$phpcsFile->addError($error, $stackPtr, 'Found');
}
}