Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
CombinatorIndentationSniff.php
Go to the documentation of this file.
1 <?php
6 namespace Magento\Sniffs\Less;
7 
8 use PHP_CodeSniffer\Sniffs\Sniff;
9 use PHP_CodeSniffer\Files\File;
10 
19 class CombinatorIndentationSniff implements Sniff
20 {
27 
31  public function register()
32  {
33  return [T_PLUS];
34  }
35 
39  public function process(File $phpcsFile, $stackPtr)
40  {
41  $tokens = $phpcsFile->getTokens();
42 
43  $prevPtr = $stackPtr - 1;
44  $nextPtr = $stackPtr + 1;
45 
46  if (($tokens[$prevPtr]['code'] !== T_WHITESPACE) || ($tokens[$nextPtr]['code'] !== T_WHITESPACE)) {
47  $phpcsFile->addError('Spaces should be before and after combinators', $stackPtr, 'NoSpaces');
48  }
49  }
50 }
$tokens
Definition: cards_list.phtml:9