Mercurial > hg > isophonics-drupal-site
comparison vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/WhiteSpace/OpenBracketSpacingSniff.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_WhiteSpace_OpenBracketSpacingSniff. | 3 * \Drupal\Sniffs\WhiteSpace\OpenBracketSpacingSniff. |
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\WhiteSpace; | |
11 | |
12 use PHP_CodeSniffer\Files\File; | |
13 use PHP_CodeSniffer\Sniffs\Sniff; | |
14 | |
10 /** | 15 /** |
11 * Checks that there is no white space after an opening bracket, for "(" and "{". | 16 * Checks that there is no white space after an opening bracket, for "(" and "{". |
12 * Square Brackets are handled by Squiz_Sniffs_Arrays_ArrayBracketSpacingSniff. | 17 * Square Brackets are handled by |
18 * \PHP_CodeSniffer\Standards\Squiz\Sniffs\Arrays\ArrayBracketSpacingSniff. | |
13 * | 19 * |
14 * @category PHP | 20 * @category PHP |
15 * @package PHP_CodeSniffer | 21 * @package PHP_CodeSniffer |
16 * @link http://pear.php.net/package/PHP_CodeSniffer | 22 * @link http://pear.php.net/package/PHP_CodeSniffer |
17 */ | 23 */ |
18 class Drupal_Sniffs_WhiteSpace_OpenBracketSpacingSniff implements PHP_CodeSniffer_Sniff | 24 class OpenBracketSpacingSniff implements Sniff |
19 { | 25 { |
20 | 26 |
21 /** | 27 /** |
22 * A list of tokenizers this sniff supports. | 28 * A list of tokenizers this sniff supports. |
23 * | 29 * |
46 | 52 |
47 | 53 |
48 /** | 54 /** |
49 * Processes this test, when one of its tokens is encountered. | 55 * Processes this test, when one of its tokens is encountered. |
50 * | 56 * |
51 * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. | 57 * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. |
52 * @param int $stackPtr The position of the current token | 58 * @param int $stackPtr The position of the current token |
53 * in the stack passed in $tokens. | 59 * in the stack passed in $tokens. |
54 * | 60 * |
55 * @return void | 61 * @return void |
56 */ | 62 */ |
57 public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) | 63 public function process(File $phpcsFile, $stackPtr) |
58 { | 64 { |
59 $tokens = $phpcsFile->getTokens(); | 65 $tokens = $phpcsFile->getTokens(); |
60 | 66 |
61 // Ignore curly brackets in javascript files. | 67 // Ignore curly brackets in javascript files. |
62 if ($tokens[$stackPtr]['code'] === T_OPEN_CURLY_BRACKET | 68 if ($tokens[$stackPtr]['code'] === T_OPEN_CURLY_BRACKET |