| Conditions | 1 |
| Paths | 1 |
| Total Lines | 87 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 34 | public function docblockProvider() |
||
| 35 | { |
||
| 36 | return [ |
||
| 37 | 'empty single line docbloc' => [ |
||
| 38 | <<<DOCBLOCK |
||
| 39 | /** */ |
||
| 40 | DOCBLOCK |
||
| 41 | , |
||
| 42 | [ |
||
| 43 | DocBlockLexer::T_START, |
||
| 44 | DocBlockLexer::T_END |
||
| 45 | ] |
||
| 46 | ], |
||
| 47 | 'empty docbloc' => [ |
||
| 48 | <<<DOCBLOCK |
||
| 49 | /** |
||
| 50 | */ |
||
| 51 | DOCBLOCK |
||
| 52 | , |
||
| 53 | [ |
||
| 54 | DocBlockLexer::T_START, |
||
| 55 | DocBlockLexer::T_CRLF, |
||
| 56 | DocBlockLexer::T_END |
||
| 57 | ] |
||
| 58 | ], |
||
| 59 | 'docblock with summary' => [ |
||
| 60 | <<<DOCBLOCK |
||
| 61 | /** |
||
| 62 | * My docblock summary. |
||
| 63 | */ |
||
| 64 | DOCBLOCK |
||
| 65 | , |
||
| 66 | [ |
||
| 67 | DocBlockLexer::T_START, |
||
| 68 | DocBlockLexer::T_CRLF, |
||
| 69 | DocBlockLexer::T_LINE_START, |
||
| 70 | DocBlockLexer::T_WHITESPACE, |
||
| 71 | DocBlockLexer::T_STRING, |
||
| 72 | DocBlockLexer::T_WHITESPACE, |
||
| 73 | DocBlockLexer::T_STRING, |
||
| 74 | DocBlockLexer::T_WHITESPACE, |
||
| 75 | DocBlockLexer::T_STRING, |
||
| 76 | DocBlockLexer::T_DOT, |
||
| 77 | DocBlockLexer::T_CRLF, |
||
| 78 | DocBlockLexer::T_END |
||
| 79 | ] |
||
| 80 | ], |
||
| 81 | 'docblock simple tag' => [ |
||
| 82 | <<<DOCBLOCK |
||
| 83 | /** |
||
| 84 | * @var |
||
| 85 | */ |
||
| 86 | DOCBLOCK |
||
| 87 | , |
||
| 88 | [ |
||
| 89 | DocBlockLexer::T_START, |
||
| 90 | DocBlockLexer::T_CRLF, |
||
| 91 | DocBlockLexer::T_LINE_START, |
||
| 92 | DocBlockLexer::T_WHITESPACE, |
||
| 93 | DocBlockLexer::T_AT, |
||
| 94 | DocBlockLexer::T_STRING, |
||
| 95 | DocBlockLexer::T_CRLF, |
||
| 96 | DocBlockLexer::T_END |
||
| 97 | ] |
||
| 98 | ], |
||
| 99 | 'docblock specialized tags' => [ |
||
| 100 | <<<DOCBLOCK |
||
| 101 | /** |
||
| 102 | * @var:unittest |
||
| 103 | */ |
||
| 104 | DOCBLOCK |
||
| 105 | , |
||
| 106 | [ |
||
| 107 | DocBlockLexer::T_START, |
||
| 108 | DocBlockLexer::T_CRLF, |
||
| 109 | DocBlockLexer::T_LINE_START, |
||
| 110 | DocBlockLexer::T_WHITESPACE, |
||
| 111 | DocBlockLexer::T_AT, |
||
| 112 | DocBlockLexer::T_STRING, |
||
| 113 | DocBlockLexer::T_COLON, |
||
| 114 | DocBlockLexer::T_STRING, |
||
| 115 | DocBlockLexer::T_CRLF, |
||
| 116 | DocBlockLexer::T_END |
||
| 117 | ] |
||
| 118 | ] |
||
| 119 | ]; |
||
| 120 | } |
||
| 121 | } |
||
| 122 |