| Conditions | 5 |
| Paths | 5 |
| Total Lines | 25 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 15 |
| CRAP Score | 5.0061 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 19 | 22 | public function pass(ClassMethod $methodStmt, Context $context) |
|
| 20 | { |
||
| 21 | 22 | $functionName = $methodStmt->name; |
|
| 22 | 22 | if (!$functionName) { |
|
| 23 | return false; |
||
| 24 | } |
||
| 25 | |||
| 26 | 22 | if (substr($functionName, 0, 4) !== 'test') { |
|
| 27 | 9 | return false; |
|
| 28 | } |
||
| 29 | |||
| 30 | 15 | if ($methodStmt->getDocComment()) { |
|
| 31 | 11 | $phpdoc = new DocBlock($methodStmt->getDocComment()->getText()); |
|
| 32 | |||
| 33 | 11 | if ($phpdoc->hasTag('test')) { |
|
| 34 | 1 | $context->notice( |
|
| 35 | 1 | 'test.annotation', |
|
| 36 | 1 | 'Annotation @test is not needed when the method is prefixed with test.', |
|
| 37 | $methodStmt |
||
| 38 | 1 | ); |
|
| 39 | 1 | return true; |
|
| 40 | } |
||
| 41 | 11 | } |
|
| 42 | 15 | return false; |
|
| 43 | } |
||
| 44 | |||
| 68 |