Completed
Push — master ( 75f7df...d4acb3 )
by Дмитрий
07:09 queued 14s
created

MissingDocblock::getRegister()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 9
nc 1
nop 0
dl 0
loc 12
ccs 9
cts 9
cp 1
crap 1
rs 9.4285
c 1
b 0
f 0
1
<?php
2
3
namespace PHPSA\Analyzer\Pass\Statement;
4
5
use PhpParser\Node\Stmt;
6
use PHPSA\Analyzer\Pass\AnalyzerPassInterface;
7
use PHPSA\Context;
8
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
9
10
class MissingDocblock implements AnalyzerPassInterface
11
{
12
    /**
13
     * @param Stmt $stmt
14
     * @param Context $context
15
     * @return bool
16
     */
17 30
    public function pass(Stmt $stmt, Context $context)
18
    {
19 30
        if ($stmt->getDocComment() === null) {
20 30
            $context->notice(
21 30
                'missing_docblock',
22 30
                'Missing Docblock',
23
                $stmt
24 30
            );
25
26 30
            return true;
27
        }
28
        
29 17
        return false;
30
    }
31
32
    /**
33
     * @return array
34
     */
35 1
    public function getRegister()
36
    {
37
        return [
38 1
            Stmt\Class_::class,
39 1
            Stmt\ClassMethod::class,
40 1
            Stmt\Property::class,
41 1
            Stmt\Function_::class,
42 1
            Stmt\Trait_::class,
43 1
            Stmt\Interface_::class,
44 1
            Stmt\ClassConst::class,
45 1
        ];
46
    }
47
}
48