Completed
Pull Request — master (#139)
by Kévin
03:44
created

DoNotUseGoto   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
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 26
ccs 6
cts 6
cp 1
rs 10
c 1
b 0
f 0
wmc 2
lcom 0
cbo 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A pass() 0 6 1
A getRegister() 0 6 1
1
<?php
2
3
namespace PHPSA\Analyzer\Pass\Statement;
4
5
use PhpParser\Node\Stmt;
6
use PHPSA\Analyzer\Helper\DefaultMetadataPassTrait;
7
use PHPSA\Analyzer\Pass;
8
use PHPSA\Context;
9
10
class DoNotUseGoto implements Pass\AnalyzerPassInterface
11
{
12
    use DefaultMetadataPassTrait;
13
14
    /**
15
     * @param Stmt\Goto_ $stmt
16
     * @param Context $context
17
     * @return bool
18
     */
19 1
    public function pass(Stmt\Goto_ $stmt, Context $context)
20
    {
21 1
        $context->notice('do_not_use_goto', 'Do not use goto statements', $stmt);
22
23 1
        return true;
24
    }
25
26
    /**
27
     * @return array
28
     */
29 1
    public function getRegister()
30
    {
31
        return [
32 1
            Stmt\Goto_::class,
33 1
        ];
34
    }
35
}
36