| Conditions | 1 |
| Paths | 1 |
| Total Lines | 71 |
| Code Lines | 69 |
| 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 |
||
| 53 | public static function getReservedWords(): array |
||
| 54 | { |
||
| 55 | return [ |
||
| 56 | 'abstract', |
||
| 57 | 'and', |
||
| 58 | 'array', |
||
| 59 | 'as', |
||
| 60 | 'break', |
||
| 61 | 'case', |
||
| 62 | 'catch', |
||
| 63 | 'class', |
||
| 64 | 'clone', |
||
| 65 | 'const', |
||
| 66 | 'continue', |
||
| 67 | 'declare', |
||
| 68 | 'default', |
||
| 69 | 'do', |
||
| 70 | 'else', |
||
| 71 | 'elseif', |
||
| 72 | 'enddeclare', |
||
| 73 | 'endfor', |
||
| 74 | 'endforeach', |
||
| 75 | 'endif', |
||
| 76 | 'endswitch', |
||
| 77 | 'endwhile', |
||
| 78 | 'extends', |
||
| 79 | 'final', |
||
| 80 | 'for', |
||
| 81 | 'foreach', |
||
| 82 | 'function', |
||
| 83 | 'global', |
||
| 84 | 'goto', |
||
| 85 | 'if', |
||
| 86 | 'implements', |
||
| 87 | 'interface', |
||
| 88 | 'instanceof', |
||
| 89 | 'namespace', |
||
| 90 | 'new', |
||
| 91 | 'or', |
||
| 92 | 'private', |
||
| 93 | 'protected', |
||
| 94 | 'public', |
||
| 95 | 'static', |
||
| 96 | 'switch', |
||
| 97 | 'throw', |
||
| 98 | 'try', |
||
| 99 | 'use', |
||
| 100 | 'var', |
||
| 101 | 'while', |
||
| 102 | 'xor', |
||
| 103 | '__CLASS__', |
||
| 104 | '__DIR__', |
||
| 105 | '__FILE__', |
||
| 106 | '__LINE__', |
||
| 107 | '__FUNCTION__', |
||
| 108 | '__METHOD__', |
||
| 109 | '__NAMESPACE__', |
||
| 110 | 'die', |
||
| 111 | 'echo', |
||
| 112 | 'empty', |
||
| 113 | 'exit', |
||
| 114 | 'eval', |
||
| 115 | 'include', |
||
| 116 | 'include_once', |
||
| 117 | 'isset', |
||
| 118 | 'list', |
||
| 119 | 'require', |
||
| 120 | 'require_once', |
||
| 121 | 'return', |
||
| 122 | 'print', |
||
| 123 | 'unset' |
||
| 124 | ]; |
||
| 127 |