No Description

ConcatenationSpacingSniff.php 597B

1234567891011121314151617181920212223
  1. <?php
  2. class PHPCS_Sniffs_Whitespace_ConcatenationSpacingSniff implements PHP_CodeSniffer_Sniff
  3. {
  4. public function register()
  5. {
  6. return array(T_STRING_CONCAT);
  7. }
  8. public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
  9. {
  10. $tokens = $phpcsFile->getTokens();
  11. if ($tokens[($stackPtr - 1)]['code'] !== T_WHITESPACE ||
  12. $tokens[($stackPtr + 1)]['code'] !== T_WHITESPACE) {
  13. $phpcsFile->addError(
  14. 'Concatenation operator must be surrounded by whitespace',
  15. $stackPtr
  16. );
  17. }
  18. }
  19. }