| Conditions | 10 |
| Paths | 10 |
| Total Lines | 26 |
| 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 |
||
| 11 | public function isBuiltInParamTypeHint($type) |
||
| 12 | { |
||
| 13 | switch ($type) { |
||
| 14 | case 'self': |
||
| 15 | case 'array': |
||
| 16 | return true; |
||
| 17 | |||
| 18 | case 'callable': |
||
| 19 | return PHP_VERSION_ID >= 50400; |
||
| 20 | |||
| 21 | case 'bool': |
||
| 22 | case 'float': |
||
| 23 | case 'int': |
||
| 24 | case 'string': |
||
| 25 | return PHP_VERSION_ID >= 70000; |
||
| 26 | |||
| 27 | case 'iterable': |
||
| 28 | return PHP_VERSION_ID >= 70100; |
||
| 29 | |||
| 30 | case 'object': |
||
| 31 | return PHP_VERSION_ID >= 70200; |
||
| 32 | |||
| 33 | default: |
||
| 34 | return false; |
||
| 35 | } |
||
| 36 | } |
||
| 37 | |||
| 47 |