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 |
||
21 | 23 | public function pass(ClassMethod $methodStmt, Context $context) |
|
22 | { |
||
23 | 23 | $functionName = $methodStmt->name; |
|
24 | 23 | if (!$functionName) { |
|
25 | return false; |
||
26 | } |
||
27 | |||
28 | 23 | if (substr($functionName, 0, 4) !== 'test') { |
|
29 | 10 | return false; |
|
30 | } |
||
31 | |||
32 | 15 | if ($methodStmt->getDocComment()) { |
|
33 | 11 | $phpdoc = new DocBlock($methodStmt->getDocComment()->getText()); |
|
34 | |||
35 | 11 | if ($phpdoc->hasTag('test')) { |
|
36 | 1 | $context->notice( |
|
37 | 1 | 'test.annotation', |
|
38 | 1 | 'Annotation @test is not needed when the method is prefixed with test.', |
|
39 | $methodStmt |
||
40 | 1 | ); |
|
41 | 1 | return true; |
|
42 | } |
||
43 | 11 | } |
|
44 | 15 | return false; |
|
45 | } |
||
46 | |||
57 |