comparison vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/ControlStructures/InlineControlStructureSniff.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_ControlStructures_InlineControlStructureSniff. 3 * \Drupal\Sniffs\ControlStructures\InlineControlStructureSniff.
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\ControlStructures;
11
12 use PHP_CodeSniffer\Files\File;
13 use PHP_CodeSniffer\Standards\Generic\Sniffs\ControlStructures\InlineControlStructureSniff as GenericInlineControlStructureSniff;
14
10 /** 15 /**
11 * Drupal_Sniffs_ControlStructures_InlineControlStructureSniff. 16 * \Drupal\Sniffs\ControlStructures\InlineControlStructureSniff.
12 * 17 *
13 * Verifies that inline control statements are not present. This Sniff overides 18 * Verifies that inline control statements are not present. This Sniff overides
14 * the generic sniff because Drupal template files may use the alternative 19 * the generic sniff because Drupal template files may use the alternative
15 * syntax for control structures. See 20 * syntax for control structures. See
16 * http://www.php.net/manual/en/control-structures.alternative-syntax.php 21 * http://www.php.net/manual/en/control-structures.alternative-syntax.php
17 * 22 *
18 * @category PHP 23 * @category PHP
19 * @package PHP_CodeSniffer 24 * @package PHP_CodeSniffer
20 * @link http://pear.php.net/package/PHP_CodeSniffer 25 * @link http://pear.php.net/package/PHP_CodeSniffer
21 */ 26 */
22 class Drupal_Sniffs_ControlStructures_InlineControlStructureSniff 27 class InlineControlStructureSniff extends GenericInlineControlStructureSniff
23 extends Generic_Sniffs_ControlStructures_InlineControlStructureSniff
24 { 28 {
25 29
26 30
27 /** 31 /**
28 * Processes this test, when one of its tokens is encountered. 32 * Processes this test, when one of its tokens is encountered.
29 * 33 *
30 * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. 34 * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
31 * @param int $stackPtr The position of the current token in 35 * @param int $stackPtr The position of the current token in
32 * the stack passed in $tokens. 36 * the stack passed in $tokens.
33 * 37 *
34 * @return void 38 * @return void
35 */ 39 */
36 public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) 40 public function process(File $phpcsFile, $stackPtr)
37 { 41 {
38 $tokens = $phpcsFile->getTokens(); 42 $tokens = $phpcsFile->getTokens();
39 43
40 // Check for the alternate syntax for control structures with colons (:). 44 // Check for the alternate syntax for control structures with colons (:).
41 if (isset($tokens[$stackPtr]['parenthesis_closer']) === true) { 45 if (isset($tokens[$stackPtr]['parenthesis_closer']) === true) {