| Conditions | 3 | 
| Paths | 3 | 
| Total Lines | 20 | 
| Code Lines | 13 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Tests | 13 | 
| CRAP Score | 3 | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
| 1 | <?php | ||
| 24 | 2 | public function pass(Closure $expr, Context $context) | |
| 25 |     { | ||
| 26 | 2 | $varUsed = []; | |
| 27 | 2 |         foreach ($expr->uses as $use) { | |
| 28 | 1 | $var = $context->getExpressionCompiler()->compile($use->var); | |
| 29 | 1 |             if (in_array($var->getValue(), $varUsed)) { | |
| 30 | 1 | $context->notice( | |
| 31 | 1 | 'duplicated_variable_in_use_closure', | |
| 32 | 1 |                     sprintf("Duplicated variable $%s in use statement.", $use->var), | |
| 33 | $expr | ||
| 34 | 1 | ); | |
| 35 | |||
| 36 | 1 | return false; | |
| 37 |             } else { | ||
| 38 | 1 | array_push($varUsed, $use->var); | |
| 39 | } | ||
| 40 | 2 | } | |
| 41 | |||
| 42 | 2 | return true; | |
| 43 | } | ||
| 44 | |||
| 52 | 
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italyis not defined by the methodfinale(...).The most likely cause is that the parameter was removed, but the annotation was not.