getWarningList()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/**
4
 * This file is part of the mo4-coding-standard (phpcs standard)
5
 *
6
 * PHP version 5
7
 *
8
 * @category PHP
9
 * @package  PHP_CodeSniffer-MO4
10
 * @author   Xaver Loppenstedt <[email protected]>
11
 * @license  http://spdx.org/licenses/MIT MIT License
12
 * @version  GIT: master
13
 * @link     https://github.com/Mayflower/mo4-coding-standard
14
 */
15
16
namespace MO4\Tests\Formatting;
17
18
use PHP_CodeSniffer\Exceptions\RuntimeException;
19
use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
20
21
/**
22
 * Unit test class for the AlphabeticalUseStatements sniff.
23
 *
24
 * A sniff unit test checks a .inc file for expected violations of a single
25
 * coding standard. Expected errors and warnings are stored in this class.
26
 *
27
 * @category  PHP
28
 * @package   PHP_CodeSniffer-MO4
29
 * @author    Xaver Loppenstedt <[email protected]>
30
 * @copyright 2013-2017 Xaver Loppenstedt, some rights reserved.
31
 * @license   http://spdx.org/licenses/MIT MIT License
32
 * @link      https://github.com/Mayflower/mo4-coding-standard
33
 */
34
class AlphabeticalUseStatementsUnitTest extends AbstractSniffUnitTest
35
{
36
37
38
    /**
39
     * Returns the lines where errors should occur.
40
     *
41
     * The key of the array should represent the line number and the value
42
     * should represent the number of errors that should occur on that line.
43
     *
44
     * @param string $testFile test file
45
     *
46
     * @return array<int, int>
0 ignored issues
show
Documentation introduced by
The doc-type array<int, could not be parsed: Expected ">" at position 5, but found "end of type". (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...
47
     * @throws RuntimeException
48
     */
49
    protected function getErrorList($testFile='')
50
    {
51
        switch ($testFile) {
52
        case 'AlphabeticalUseStatementsUnitTest.pass.inc':
53
            return array();
54
        case 'AlphabeticalUseStatementsUnitTest.fail.1.inc':
55
            return array(
56
                    4  => 1,
57
                    5  => 1,
58
                    8  => 1,
59
                    9  => 1,
60
                    12 => 1,
61
                   );
62
        // Take care, more than one fix will be applied.
63
        case 'AlphabeticalUseStatementsUnitTest.fail.2.inc':
64
            return array(
65
                    6 => 1,
66
                    8 => 1,
67
                   );
68
        case 'AlphabeticalUseStatementsUnitTest.fail.3.inc':
69
            return array(
70
                    7  => 1,
71
                    8  => 1,
72
                    10 => 1,
73
                    15 => 1,
74
                   );
75
        case 'AlphabeticalUseStatementsUnitTest.fail.4.inc':
76
            return array(
77
                    4  => 1,
78
                    8  => 1,
79
                    13 => 1,
80
                    17 => 1,
81
                    20 => 1,
82
                    21 => 1,
83
                   );
84
        case 'AlphabeticalUseStatementsUnitTest.fail.5.inc':
85
            return array(12 => 1);
86
        }//end switch
87
88
        throw new RuntimeException("Testfile {$testFile} in ".__DIR__." is not handled by ".__CLASS__);
89
90
    }//end getErrorList()
91
92
93
    /**
94
     * Returns the lines where warnings should occur.
95
     *
96
     * The key of the array should represent the line number and the value
97
     * should represent the number of warnings that should occur on that line.
98
     *
99
     * @return array<int, int>
0 ignored issues
show
Documentation introduced by
The doc-type array<int, could not be parsed: Expected ">" at position 5, but found "end of type". (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...
100
     */
101
    protected function getWarningList()
102
    {
103
        return array();
104
105
    }//end getWarningList()
106
107
108
}//end class
109