Conditions | 7 |
Paths | 3 |
Total Lines | 28 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 56 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
19 | public function pass(ClassMethod $st, Context $context) |
||
|
|||
20 | { |
||
21 | if (count($st->stmts) == 0) { |
||
22 | return false; |
||
23 | } |
||
24 | |||
25 | $result = false; |
||
26 | |||
27 | if ($st->name == '__construct' || $st->name == '__destruct') { |
||
28 | foreach ($st->stmts as $stmt) { |
||
29 | if ($stmt instanceof Return_) { |
||
30 | if (!$stmt->expr) { |
||
31 | continue; |
||
32 | } |
||
33 | |||
34 | $context->notice( |
||
35 | 'return.construct', |
||
36 | sprintf('Method %s cannot return a value.', $st->name), |
||
37 | $stmt |
||
38 | ); |
||
39 | |||
40 | $result = true; |
||
41 | } |
||
42 | } |
||
43 | } |
||
44 | |||
45 | return $result; |
||
46 | } |
||
47 | } |
||
48 |
Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.