Completed
Pull Request — master (#19)
by
unknown
07:50
created

MethodDocSniff::checkBlankLines()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 3
Ratio 42.86 %

Code Coverage

Tests 3
CRAP Score 2.0625

Importance

Changes 0
Metric Value
dl 3
loc 7
ccs 3
cts 4
cp 0.75
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 3
nc 2
nop 2
crap 2.0625
1
<?php
2
3
declare(strict_types=1);
4
5
namespace BestIt\Sniffs\Commenting;
6
7
/**
8
 * Class MethodDocSniff
9
 *
10
 * @package BestIt\Sniffs\Commenting
11
 * @author Nick Lubisch <[email protected]>
12
 */
13
class MethodDocSniff extends AbstractDocSniff
14
{
15
    /**
16
     * Returns which tokens should be listened to.
17
     *
18
     * @return int[] List of tokens which is to be listened to
19
     */
20 28
    public function getListenedTokens(): array
21
    {
22
        return [
23 28
            T_FUNCTION
24
        ];
25
    }
26
27
    /**
28
     * Returns allowed tag metadata.
29
     *
30
     * @return array List of tag metadata
31
     */
32 26
    public function getTagMetadata(): array
33
    {
34
        return [
35 26
            '@param' => [
36
                'min' => 0,
37
                'max' => null,
38
                'lineAfter' => true
39
            ],
40
            '@return' => [
41 26
                'min' => 1,
42 26
                'max' => 1,
43 26
                'if' => [$this->getTagHelper(), 'isNoWhitelistedFunction'],
44
                'lineAfter' => true
45
            ],
46
            '@throws' => [
47
                'min' => 0,
48
                'max' => null
49
            ],
50
            '@deprecated' => [
51
                'min' => 0,
52
                'max' => 1
53
            ],
54
            '@link' => [
55
                'min' => 0,
56
                'max' => null
57
            ]
58
        ];
59
    }
60
61
    /**
62
     * Returns an array of disallowed tokens.
63
     *
64
     * @return array List of disallowed tags
65
     */
66 26 View Code Duplication
    public function getDisallowedTags(): array
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
67
    {
68
        return [
69 26
            '@api',
70
            '@author',
71
            '@category',
72
            '@copyright',
73
            '@filesource',
74
            '@global',
75
            '@ignore',
76
            '@internal',
77
            '@license',
78
            '@link',
79
            '@method',
80
            '@package',
81
            '@property',
82
            '@property-read',
83
            '@property-write',
84
            '@see',
85
            '@since',
86
            '@source',
87
            '@subpackage',
88
            '@todo',
89
            '@uses',
90
            '@var',
91
            '@version',
92
            '@inheritdoc'
93
        ];
94
    }
95
}
96