PHP_CodeSniffer
[ class tree: PHP_CodeSniffer ] [ index: PHP_CodeSniffer ] [ all elements ]

Source for file ControlSignatureSniff.php

Documentation is available at ControlSignatureSniff.php

  1. <?php
  2. /**
  3.  * Verifies that control statements conform to their coding standards.
  4.  *
  5.  * @author    Greg Sherwood <gsherwood@squiz.net>
  6.  * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
  7.  * @license   https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
  8.  */
  9.  
  10. namespace PHP_CodeSniffer\Standards\PEAR\Sniffs\ControlStructures;
  11.  
  12. use PHP_CodeSniffer\Sniffs\AbstractPatternSniff;
  13.  
  14. class ControlSignatureSniff extends AbstractPatternSniff
  15. {
  16.  
  17.     /**
  18.      * If true, comments will be ignored if they are found in the code.
  19.      *
  20.      * @var boolean 
  21.      */
  22.     public $ignoreComments = true;
  23.  
  24.  
  25.     /**
  26.      * Returns the patterns that this test wishes to verify.
  27.      *
  28.      * @return string[] 
  29.      */
  30.     protected function getPatterns()
  31.     {
  32.         return array(
  33.                 'do {EOL...} while (...);EOL',
  34.                 'while (...) {EOL',
  35.                 'for (...) {EOL',
  36.                 'if (...) {EOL',
  37.                 'foreach (...) {EOL',
  38.                 '} else if (...) {EOL',
  39.                 '} elseif (...) {EOL',
  40.                 '} else {EOL',
  41.                 'do {EOL',
  42.                );
  43.  
  44.     }//end getPatterns()
  45.  
  46.  
  47. }//end class

Documentation generated on Mon, 11 Mar 2019 15:27:20 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.