Passed
Pull Request — master (#184)
by Xaver
03:27
created

UnnecessaryNamespaceUsageUnitTest::getWarningList()   B

Complexity

Conditions 10
Paths 10

Size

Total Lines 48
Code Lines 41

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 2 Features 0
Metric Value
cc 10
eloc 41
c 3
b 2
f 0
nc 10
nop 1
dl 0
loc 48
rs 7.6666

How to fix   Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
/**
4
 * This file is part of the mo4-coding-standard (phpcs standard)
5
 *
6
 * @author  Xaver Loppenstedt <[email protected]>
7
 *
8
 * @license http://spdx.org/licenses/MIT MIT License
9
 *
10
 * @link    https://github.com/mayflower/mo4-coding-standard
11
 */
12
13
declare(strict_types=1);
14
15
namespace MO4\Tests\Formatting;
16
17
use MO4\Tests\AbstractMo4SniffUnitTest;
18
19
/**
20
 * Unit test class for the UnnecessaryNamespaceUsageUnitTest sniff.
21
 *
22
 * A sniff unit test checks a .inc file for expected violations of a single
23
 * coding standard. Expected errors and warnings are stored in this class.
24
 *
25
 * @author    Xaver Loppenstedt <[email protected]>
26
 * @author    Marco Jantke <[email protected]>
27
 * @author    Steffen Ritter <[email protected]>
28
 *
29
 * @copyright 2013-21 Xaver Loppenstedt, some rights reserved.
30
 *
31
 * @license   http://spdx.org/licenses/MIT MIT License
32
 *
33
 * @link      https://github.com/mayflower/mo4-coding-standard
34
 */
35
class UnnecessaryNamespaceUsageUnitTest extends AbstractMo4SniffUnitTest
36
{
37
    protected $expectedWarningList = [
38
        'UnnecessaryNamespaceUsageUnitTest.pass.1.inc' => [],
39
        'UnnecessaryNamespaceUsageUnitTest.pass.2.inc' => [],
40
        'UnnecessaryNamespaceUsageUnitTest.pass.3.inc' => [],
41
        'UnnecessaryNamespaceUsageUnitTest.pass.4.inc' => [],
42
        'UnnecessaryNamespaceUsageUnitTest.pass.5.inc' => [],
43
        'UnnecessaryNamespaceUsageUnitTest.fail.1.inc' => [
44
            17 => 1,
45
            19 => 1,
46
            24 => 1,
47
            25 => 1,
48
            26 => 2,
49
            28 => 1,
50
            30 => 2,
51
            32 => 1,
52
            33 => 1,
53
            40 => 1,
54
            44 => 1,
55
            45 => 1,
56
            46 => 1,
57
            52 => 1,
58
            56 => 1,
59
        ],
60
        'UnnecessaryNamespaceUsageUnitTest.fail.2.inc' => [
61
            10 => 1,
62
            11 => 1,
63
        ],
64
        'UnnecessaryNamespaceUsageUnitTest.fail.3.inc' => [
65
            15 => 1,
66
            16 => 1,
67
            17 => 1,
68
            18 => 1,
69
            22 => 1,
70
            23 => 1,
71
            25 => 3,
72
        ],
73
        'UnnecessaryNamespaceUsageUnitTest.fail.4.inc' => [],
74
    ];
75
}
76