1 | <?php |
||
11 | class ConstantNaming implements ConfigurablePassInterface, AnalyzerPassInterface |
||
12 | { |
||
13 | /** |
||
14 | * @param ClassConst $stmt |
||
15 | * @param Context $context |
||
16 | * @return bool |
||
17 | */ |
||
18 | 1 | public function pass(ClassConst $stmt, Context $context) |
|
19 | { |
||
20 | 1 | $result = false; |
|
21 | 1 | foreach ($stmt->consts as $const) { |
|
22 | 1 | if ($const->name !== strtoupper($const->name)) { |
|
23 | 1 | $context->notice( |
|
24 | 1 | 'constant.naming', |
|
25 | 1 | 'Constant names should be all uppercase.', |
|
26 | $stmt |
||
27 | 1 | ); |
|
28 | |||
29 | 1 | $result = true; |
|
30 | 1 | } |
|
31 | 1 | } |
|
32 | |||
33 | 1 | return $result; |
|
34 | } |
||
35 | |||
36 | /** |
||
37 | * @return TreeBuilder |
||
38 | */ |
||
39 | public function getConfiguration() |
||
48 | |||
49 | /** |
||
50 | * @return array |
||
51 | */ |
||
52 | 1 | public function getRegister() |
|
58 | } |
||
59 |