Completed
Pull Request — master (#139)
by Kévin
06:24
created

DoNotUseGoto::pass()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 2
dl 0
loc 6
ccs 0
cts 3
cp 0
crap 2
rs 9.4285
c 0
b 0
f 0
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
    public function pass(Stmt\Goto_ $stmt, Context $context)
20
    {
21
        $context->notice('do_not_use_goto', 'Do not use goto statements', $stmt);
22
23
        return true;
24
    }
25
26
    /**
27
     * @return array
28
     */
29
    public function getRegister()
30
    {
31
        return [
32
            Stmt\Goto_::class,
33
        ];
34
    }
35
}
36