Completed
Push — master ( cb2823...906394 )
by Alexander
02:19
created

InlineCommentUnitTest::getWarningList()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 5
rs 9.4286
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
/**
3
 * CodingStandard_Tests_Commenting_InlineCommentUnitTest.
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
/**
17
 * Unit test class for the InlineComment sniff.
18
 *
19
 * A sniff unit test checks a .inc file for expected violations of a single
20
 * coding standard. Expected errors and warnings are stored in this class.
21
 *
22
 * @category PHP
23
 * @package  PHP_CodeSniffer
24
 * @author   Greg Sherwood <[email protected]>
25
 * @author   Marc McIntyre <[email protected]>
26
 * @author   Alexander Obuhovich <[email protected]>
27
 * @license  https://github.com/aik099/CodingStandard/blob/master/LICENSE BSD 3-Clause
28
 * @link     https://github.com/aik099/CodingStandard
29
 */
30
class CodingStandard_Tests_Commenting_InlineCommentUnitTest extends AbstractSniffUnitTest
1 ignored issue
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
Coding Style introduced by
This class is not in CamelCase format.

Classes in PHP are usually named in CamelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. The whole name starts with a capital letter as well.

Thus the name database provider becomes DatabaseProvider.

Loading history...
31
{
32
33
34
    /**
35
     * Returns the lines where errors should occur.
36
     *
37
     * The key of the array should represent the line number and the value
38
     * should represent the number of errors that should occur on that line.
39
     *
40
     * @param string $testFile The name of the file being tested.
41
     *
42
     * @return array(int => int)
1 ignored issue
show
Documentation introduced by
The doc-type array(int could not be parsed: Expected "|" or "end of type", but got "(" at position 5. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
43
     */
44
    public function getErrorList($testFile)
45
    {
46
        switch ($testFile) {
47
            case 'InlineCommentUnitTest.inc':
48
                $errors = array(
49
                           17  => 1,
50
                           27  => 1,
51
                           28  => 1,
52
                           32  => 2,
53
                           36  => 1,
54
                           44  => 2,
55
                           54  => 1,
56
                           58  => 1,
57
                           61  => 1,
58
                           64  => 2,
59
                           67  => 1,
60
                           95  => 1,
61
                           96  => 1,
62
                           97  => 2,
63
                           // The @var inline comments are allowed.
64
                           118 => 0,
65
                           130 => 1,
66
                           133 => 1,
67
                           156 => 1,
68
                           // Comments starting with non-letter are allowed.
69
                           159 => 0,
70
                           162 => 0,
71
                          );
72
73
                // Before PHPCS 2.4.0 traits were not tokenized below PHP 5.4.
74
                if (version_compare(PHP_CodeSniffer::VERSION, '2.4.0', '<') && version_compare(PHP_VERSION, '5.4.0', '<')) {
75
                    $errors[106] = 1;
76
                }
77
                return $errors;
78
79
            case 'InlineCommentUnitTest.js':
80
                return array(
81
                        31  => 1,
82
                        36  => 2,
83
                        44  => 1,
84
                        48  => 1,
85
                        51  => 1,
86
                        54  => 2,
87
                        57  => 1,
88
                        102 => 1,
89
                        103 => 1,
90
                        104 => 3,
91
                        // Comments starting with digit are allowed.
92
                        113 => 0,
93
                       );
94
        }//end switch
95
96
        return array();
97
98
    }//end getErrorList()
99
100
101
    /**
102
     * Returns the lines where warnings should occur.
103
     *
104
     * The key of the array should represent the line number and the value
105
     * should represent the number of warnings that should occur on that line.
106
     *
107
     * @param string $testFile The name of the file being tested.
108
     *
109
     * @return array(int => int)
1 ignored issue
show
Documentation introduced by
The doc-type array(int could not be parsed: Expected "|" or "end of type", but got "(" at position 5. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
110
     */
111
    public function getWarningList($testFile)
112
    {
113
        return array();
114
115
    }//end getWarningList()
116
117
118
}//end class
119