comparison vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Semantics/ConstantNameSniff.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_Semantics_ConstantNameSniff 3 * \Drupal\Sniffs\Semantics\ConstantNameSniff
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
10 namespace Drupal\Sniffs\Semantics;
11
12 use Drupal\Sniffs\Semantics\FunctionCall;
13 use PHP_CodeSniffer\Files\File;
9 14
10 /** 15 /**
11 * Checks that constants introduced with define() in module or install files start 16 * Checks that constants introduced with define() in module or install files start
12 * with the module's name. 17 * with the module's name.
13 * 18 *
14 * @category PHP 19 * @category PHP
15 * @package PHP_CodeSniffer 20 * @package PHP_CodeSniffer
16 * @link http://pear.php.net/package/PHP_CodeSniffer 21 * @link http://pear.php.net/package/PHP_CodeSniffer
17 */ 22 */
18 class Drupal_Sniffs_Semantics_ConstantNameSniff extends Drupal_Sniffs_Semantics_FunctionCall 23 class ConstantNameSniff extends FunctionCall
19 { 24 {
20 25
21 26
22 /** 27 /**
23 * Returns an array of function names this test wants to listen for. 28 * Returns an array of function names this test wants to listen for.
32 37
33 38
34 /** 39 /**
35 * Processes this function call. 40 * Processes this function call.
36 * 41 *
37 * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. 42 * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
38 * @param int $stackPtr The position of the function call in 43 * @param int $stackPtr The position of the function call in
39 * the stack. 44 * the stack.
40 * @param int $openBracket The position of the opening 45 * @param int $openBracket The position of the opening
41 * parenthesis in the stack. 46 * parenthesis in the stack.
42 * @param int $closeBracket The position of the closing 47 * @param int $closeBracket The position of the closing
43 * parenthesis in the stack. 48 * parenthesis in the stack.
44 * 49 *
45 * @return void 50 * @return void
46 */ 51 */
47 public function processFunctionCall( 52 public function processFunctionCall(
48 PHP_CodeSniffer_File $phpcsFile, 53 File $phpcsFile,
49 $stackPtr, 54 $stackPtr,
50 $openBracket, 55 $openBracket,
51 $closeBracket 56 $closeBracket
52 ) { 57 ) {
53 $nameParts = explode('.', basename($phpcsFile->getFilename())); 58 $nameParts = explode('.', basename($phpcsFile->getFilename()));