comparison vendor/drupal/coder/coder_sniffer/DrupalPractice/Sniffs/General/AccessAdminPagesSniff.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 * DrupalPractice_Sniffs_General_AccessAdminPagesSniff 3 * \DrupalPractice\Sniffs\General\AccessAdminPagesSniff
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 DrupalPractice\Sniffs\General;
11
12 use PHP_CodeSniffer\Files\File;
13 use Drupal\Sniffs\Semantics\FunctionDefinition;
9 14
10 /** 15 /**
11 * Throws a warning if the "access administration pages" string is found in 16 * Throws a warning if the "access administration pages" string is found in
12 * hook_menu(). 17 * hook_menu().
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 DrupalPractice_Sniffs_General_AccessAdminPagesSniff extends Drupal_Sniffs_Semantics_FunctionDefinition 23 class AccessAdminPagesSniff extends FunctionDefinition
19 { 24 {
20 25
21 26
22 /** 27 /**
23 * Process this function definition. 28 * Process this function definition.
24 * 29 *
25 * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. 30 * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
26 * @param int $stackPtr The position of the function name in the stack. 31 * @param int $stackPtr The position of the function
27 * name in the stack. 32 * name in the stack.
28 * @param int $functionPtr The position of the function keyword in the stack. 33 * @param int $functionPtr The position of the function
29 * keyword in the stack. 34 * keyword in the stack.
30 * 35 *
31 * @return void 36 * @return void
32 */ 37 */
33 public function processFunction(PHP_CodeSniffer_File $phpcsFile, $stackPtr, $functionPtr) 38 public function processFunction(File $phpcsFile, $stackPtr, $functionPtr)
34 { 39 {
35 $fileExtension = strtolower(substr($phpcsFile->getFilename(), -6)); 40 $fileExtension = strtolower(substr($phpcsFile->getFilename(), -6));
36 // Only check in *.module files. 41 // Only check in *.module files.
37 if ($fileExtension !== 'module') { 42 if ($fileExtension !== 'module') {
38 return; 43 return;