| Conditions | 1 |
| Paths | 1 |
| Total Lines | 52 |
| Code Lines | 39 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 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 |
||
| 18 | public function successProvider(): array |
||
| 19 | { |
||
| 20 | return [ |
||
| 21 | 'param-unnamed-auto-null' => [ |
||
| 22 | [null], |
||
| 23 | Params::ALL_AUTO, |
||
| 24 | [[null, PDO::PARAM_NULL]], |
||
| 25 | ], |
||
| 26 | 'param-unnamed-auto-int' => [ |
||
| 27 | [2], |
||
| 28 | Params::ALL_AUTO, |
||
| 29 | [[2, PDO::PARAM_INT]], |
||
| 30 | ], |
||
| 31 | 'param-unnamed-auto-false' => [ |
||
| 32 | [false], |
||
| 33 | Params::ALL_AUTO, |
||
| 34 | [[false, PDO::PARAM_BOOL]], |
||
| 35 | ], |
||
| 36 | 'param-unnamed-auto-true' => [ |
||
| 37 | [true], |
||
| 38 | Params::ALL_AUTO, |
||
| 39 | [[true, PDO::PARAM_BOOL]], |
||
| 40 | ], |
||
| 41 | 'param-unnamed-auto-str' => [ |
||
| 42 | ['bar'], |
||
| 43 | Params::ALL_AUTO, |
||
| 44 | [['bar', PDO::PARAM_STR]], |
||
| 45 | ], |
||
| 46 | 'param-unnamed-str' => [ |
||
| 47 | [2], |
||
| 48 | Params::ALL_STRING, |
||
| 49 | [[2, PDO::PARAM_STR]], |
||
| 50 | ], |
||
| 51 | 'param-unnamed-manual' => [ |
||
| 52 | [[2, PDO::PARAM_BOOL]], |
||
| 53 | Params::ALL_MANUAL, |
||
| 54 | [[2, PDO::PARAM_BOOL]], |
||
| 55 | ], |
||
| 56 | 'param-named-auto' => [ |
||
| 57 | ['foo' => 2], |
||
| 58 | Params::ALL_AUTO, |
||
| 59 | ['foo' => [2, PDO::PARAM_INT]], |
||
| 60 | ], |
||
| 61 | 'param-named-str' => [ |
||
| 62 | ['foo' => 2], |
||
| 63 | Params::ALL_STRING, |
||
| 64 | ['foo' => [2, PDO::PARAM_STR]], |
||
| 65 | ], |
||
| 66 | 'param-named-manual' => [ |
||
| 67 | ['foo' => [2, PDO::PARAM_BOOL]], |
||
| 68 | Params::ALL_MANUAL, |
||
| 69 | ['foo' => [2, PDO::PARAM_BOOL]], |
||
| 70 | ], |
||
| 124 |