Conditions | 8 |
Paths | 8 |
Total Lines | 33 |
Lines | 0 |
Ratio | 0 % |
Tests | 15 |
CRAP Score | 8.2964 |
Changes | 0 |
1 | <?php |
||
25 | 3 | public function enterNode(Node $node) |
|
26 | { |
||
27 | 3 | if (!$this->isFormType($node)) { |
|
28 | 3 | return; |
|
29 | } |
||
30 | |||
31 | 3 | if (!$node instanceof Node\Expr\Array_) { |
|
32 | 3 | return; |
|
33 | } |
||
34 | |||
35 | 3 | foreach ($node->items as $item) { |
|
36 | 3 | if (!$item->key instanceof Node\Scalar\String_) { |
|
37 | 1 | continue; |
|
38 | } |
||
39 | |||
40 | 3 | if ('invalid_message' !== $item->key->value) { |
|
41 | 3 | continue; |
|
42 | } |
||
43 | |||
44 | 2 | if (!$item->value instanceof Node\Scalar\String_) { |
|
45 | $this->addError($item, 'Form label is not a scalar string'); |
||
46 | |||
47 | continue; |
||
48 | } |
||
49 | |||
50 | 2 | $label = $item->value->value; |
|
51 | 2 | if (empty($label)) { |
|
52 | continue; |
||
53 | } |
||
54 | |||
55 | 2 | $this->addLocation($label, $node->getAttribute('startLine'), $node, ['domain' => 'validators']); |
|
56 | } |
||
57 | 3 | } |
|
58 | |||
71 |