| 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 |
||
| 28 | 24 | public function pass(ClassMethod $methodStmt, Context $context) |
|
| 29 | { |
||
| 30 | 24 | $functionName = $methodStmt->name; |
|
| 31 | 24 | if (!$functionName) { |
|
| 32 | return false; |
||
| 33 | } |
||
| 34 | |||
| 35 | 24 | if (substr($functionName, 0, 4) !== 'test') { |
|
| 36 | 11 | return false; |
|
| 37 | } |
||
| 38 | |||
| 39 | 15 | if ($methodStmt->getDocComment()) { |
|
| 40 | 11 | $phpdoc = $this->docBlockFactory->create($methodStmt->getDocComment()->getText()); |
|
| 41 | |||
| 42 | 11 | if ($phpdoc->hasTag('test')) { |
|
| 43 | 1 | $context->notice( |
|
| 44 | 1 | 'test.annotation', |
|
| 45 | 1 | 'Annotation @test is not needed when the method is prefixed with test.', |
|
| 46 | $methodStmt |
||
| 47 | 1 | ); |
|
| 48 | 1 | return true; |
|
| 49 | } |
||
| 50 | 11 | } |
|
| 51 | 15 | return false; |
|
| 52 | } |
||
| 53 | |||
| 77 |