Failed Conditions
Push — phpcs-3-upgrade ( d91341 )
by Alexander
02:06
created

ControlSignatureSniff   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 45
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getPatterns() 0 16 1
1
<?php
2
/**
3
 * CodingStandard_Sniffs_ControlStructures_ControlSignatureSniff.
4
 *
5
 * PHP version 5
6
 *
7
 * @category PHP
8
 * @package  PHP_CodeSniffer
9
 * @author   Greg Sherwood <[email protected]>
10
 * @author   Marc McIntyre <[email protected]>
11
 * @author   Alexander Obuhovich <[email protected]>
12
 * @license  https://github.com/aik099/CodingStandard/blob/master/LICENSE BSD 3-Clause
13
 * @link     https://github.com/aik099/CodingStandard
14
 */
15
16
namespace CodingStandard\Sniffs\ControlStructures;
17
18
use PHP_CodeSniffer\Sniffs\AbstractPatternSniff;
19
20
/**
21
 * Verifies that control statements conform to their coding standards.
22
 *
23
 * @category PHP
24
 * @package  PHP_CodeSniffer
25
 * @author   Greg Sherwood <[email protected]>
26
 * @author   Marc McIntyre <[email protected]>
27
 * @author   Alexander Obuhovich <[email protected]>
28
 * @license  https://github.com/aik099/CodingStandard/blob/master/LICENSE BSD 3-Clause
29
 * @link     https://github.com/aik099/CodingStandard
30
 */
31
class ControlSignatureSniff extends AbstractPatternSniff
32
{
33
34
    /**
35
     * A list of tokenizers this sniff supports.
36
     *
37
     * @var array
38
     */
39
    public $supportedTokenizers = array(
40
                                   'PHP',
41
                                   'JS',
42
                                  );
43
44
45
    /**
46
     * Constructs a PEAR_Sniffs_ControlStructures_ControlSignatureSniff.
47
     */
48
    public function __construct()
49
    {
50
        parent::__construct(true);
51
    }//end __construct()
52
53
54
    /**
55
     * Returns the patterns that this test wishes to verify.
56
     *
57
     * @return string[]
58
     */
59
    protected function getPatterns()
60
    {
61
        return array(
62
                'do {EOL...} while (...);EOL',
63
                'while (...) {EOL',
64
                'switch (...) {EOL',
65
                'for (...) {EOL',
66
                'if (...) {EOL',
67
                'foreach (...) {EOL',
68
                '}EOLelseif (...) {EOL',
69
                '}EOLelse {EOL',
70
                'do {EOL',
71
                'try {EOL',
72
                '}EOLcatch (...) {EOL',
73
               );
74
    }//end getPatterns()
75
}//end class
76