| Conditions | 8 |
| Paths | 2 |
| Total Lines | 31 |
| Code Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 35 | public function leaveNode(Node $node) |
||
| 36 | { |
||
| 37 | if ($node instanceof Stmt\Class_ |
||
| 38 | || $node instanceof Stmt\Interface_ |
||
| 39 | ) { |
||
| 40 | |||
| 41 | $class = $this->metrics->get(MetricClassNameGenerator::getName($node)); |
||
|
|
|||
| 42 | |||
| 43 | |||
| 44 | $select = $while = $if = 0; |
||
| 45 | |||
| 46 | iterate_over_node($node, function ($node) use (&$while, &$select, &$if) { |
||
| 47 | switch (true) { |
||
| 48 | case $node instanceof Stmt\Do_: |
||
| 49 | case $node instanceof Stmt\Foreach_: |
||
| 50 | case $node instanceof Stmt\While_: |
||
| 51 | $while++; |
||
| 52 | break; |
||
| 53 | case $node instanceof Stmt\If_: |
||
| 54 | $if++; |
||
| 55 | break; |
||
| 56 | case $node instanceof Stmt\Switch_: |
||
| 57 | $select++; |
||
| 58 | break; |
||
| 59 | } |
||
| 60 | }); |
||
| 61 | |||
| 62 | $defect = 0.15 + 0.23 * $while + 0.22 * $select + 0.07 * $if; |
||
| 63 | $class->set('kanDefect', round($defect, 2)); |
||
| 64 | } |
||
| 65 | } |
||
| 66 | } |
||
| 67 |
This check looks for function or method calls that always return null and whose return value is assigned to a variable.
The method
getObject()can return nothing but null, so it makes no sense to assign that value to a variable.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.