Completed
Pull Request — master (#176)
by
unknown
03:02
created

ErrorSuppression::pass()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 6
nc 1
nop 2
dl 0
loc 10
ccs 0
cts 6
cp 0
crap 2
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace PHPSA\Analyzer\Pass\Expression;
4
5
use PhpParser\Node\Expr;
6
use PHPSA\Analyzer\Pass\AnalyzerPassInterface;
7
use PHPSA\Context;
8
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
9
10
class ErrorSuppression implements AnalyzerPassInterface
11
{
12
    /**
13
     * @param Expr\ErrorSuppress $expr
14
     * @param Context $context
15
     * @return bool
16
     */
17
    public function pass(Expr\ErrorSuppress $expr, Context $context)
18
    {
19
        $context->notice(
20
            'error.suppression',
21
            'Please don\'t suppress errors with the @ operator.',
22
            $expr
23
        );
24
25
        return true;
26
    }
27
28
    /**
29
     * @return array
30
     */
31
    public function getRegister()
32
    {
33
        return [
34
            Expr\ErrorSuppress::class
35
        ];
36
    }
37
}
38