Completed
Push — master ( 3bd08b...53ad3f )
by Дмитрий
02:39
created

ArrayShortDefinition::pass()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 1 Features 1
Metric Value
cc 2
eloc 6
c 1
b 1
f 1
nc 2
nop 2
dl 0
loc 10
ccs 0
cts 8
cp 0
crap 6
rs 9.4285
1
<?php
2
/**
3
 * @author Patsura Dmitry https://github.com/ovr <[email protected]>
4
 */
5
6
namespace PHPSA\Analyzer\Pass;
7
8
use PhpParser\Node\Expr;
9
use PHPSA\Compiler\Expression;
10
use PHPSA\Context;
11
12
class ArrayShortDefinition
13
{
14
    public function pass(Expr\Array_ $expr, Context $context)
15
    {
16
        if ($expr->getAttribute('kind') == Expr\Array_::KIND_LONG) {
17
            $context->notice(
18
                'array.short-syntax',
19
                'Please use [] (short syntax) for array definition.',
20
                $expr
21
            );
22
        }
23
    }
24
}
25