MultiLineArrayUnitTest::getErrorList()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 20
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 20
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 14
nc 3
nop 1
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\Arrays;
17
18
use PHP_CodeSniffer\Exceptions\RuntimeException;
19
use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
20
21
/**
22
 * Unit test class for @see MultiLineArraySniff
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 MultiLineArrayUnitTest 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 'MultiLineArrayUnitTest.pass.inc':
53
            return array();
54
        case 'MultiLineArrayUnitTest.fail.inc':
55
            return array(
56
                    4  => 1,
57
                    12 => 1,
58
                    18 => 2,
59
                    22 => 1,
60
                    24 => 1,
61
                    28 => 1,
62
                    32 => 1,
63
                   );
64
        }//end switch
65
66
        throw new RuntimeException("Testfile {$testFile} in ".__DIR__." is not handled by ".__CLASS__);
67
68
    }//end getErrorList()
69
70
71
    /**
72
     * Returns the lines where warnings should occur.
73
     *
74
     * The key of the array should represent the line number and the value
75
     * should represent the number of warnings that should occur on that line.
76
     *
77
     * @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...
78
     */
79
    protected function getWarningList()
80
    {
81
        return array();
82
83
    }//end getWarningList()
84
85
86
}//end class
87