| Conditions | 5 |
| Paths | 5 |
| Total Lines | 26 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 14 |
| CRAP Score | 5.0073 |
| Changes | 0 | ||
| 1 | <?php |
||
| 33 | 5 | public function pass(ClassMethod $methodStmt, Context $context) |
|
| 34 | { |
||
| 35 | 5 | $functionName = $methodStmt->name; |
|
| 36 | 5 | if (!$functionName) { |
|
| 37 | return false; |
||
| 38 | } |
||
| 39 | |||
| 40 | 5 | if (substr($functionName, 0, 4) !== 'test') { |
|
| 41 | 2 | return false; |
|
| 42 | } |
||
| 43 | |||
| 44 | 4 | if ($methodStmt->getDocComment()) { |
|
| 45 | 1 | $phpdoc = $this->docBlockFactory->create($methodStmt->getDocComment()->getText()); |
|
| 46 | |||
| 47 | 1 | if ($phpdoc->hasTag('test')) { |
|
| 48 | 1 | $context->notice( |
|
| 49 | 1 | 'test.annotation', |
|
| 50 | 1 | 'Annotation @test is not needed when the method is prefixed with test.', |
|
| 51 | 1 | $methodStmt |
|
| 52 | ); |
||
| 53 | 1 | return true; |
|
| 54 | } |
||
| 55 | } |
||
| 56 | |||
| 57 | 4 | return false; |
|
| 58 | } |
||
| 59 | |||
| 70 |