comparison vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Semantics/InstallHooksSniff.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_InstallHooksSniff 3 * \Drupal\Sniffs\Semantics\InstallHooksSniff
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\FunctionDefinition;
13 use PHP_CodeSniffer\Files\File;
9 14
10 /** 15 /**
11 * Checks that hook_disable(), hook_enable(), hook_install(), hook_uninstall(), 16 * Checks that hook_disable(), hook_enable(), hook_install(), hook_uninstall(),
12 * hook_requirements() and hook_schema() are not defined in the module file. 17 * hook_requirements() and hook_schema() are not defined in the module file.
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_InstallHooksSniff extends Drupal_Sniffs_Semantics_FunctionDefinition 23 class InstallHooksSniff 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 name in the stack.
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 keyword in the stack.
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;