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

ArrayShortDefinition   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A pass() 0 10 2
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