Completed
Pull Request — master (#193)
by Enrico
06:57 queued 02:48
created

MissingDocblock   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 38
ccs 17
cts 17
cp 1
rs 10
c 1
b 0
f 0
wmc 3
lcom 0
cbo 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A pass() 0 14 2
A getRegister() 0 12 1
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