| Conditions | 1 |
| Paths | 1 |
| Total Lines | 55 |
| 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 |
||
| 127 | protected function initReduceCallbacks() { |
||
| 128 | $this->reduceCallbacks = [ |
||
| 129 | 0 => function ($stackPos) { |
||
| 130 | $this->semValue = $this->semStack[$stackPos]; |
||
| 131 | }, |
||
| 132 | 1 => function ($stackPos) { |
||
|
|
|||
| 133 | $this->semValue = new AST\Docblock(); |
||
| 134 | }, |
||
| 135 | 2 => function ($stackPos) { |
||
| 136 | $this->semValue = new AST\Docblock($this->semStack[$stackPos-(5-3)]); |
||
| 137 | }, |
||
| 138 | 3 => function ($stackPos) { |
||
| 139 | $this->semValue = new AST\Docblock(null, ...$this->semStack[$stackPos-(5-3)]); |
||
| 140 | }, |
||
| 141 | 4 => function ($stackPos) { |
||
| 142 | $this->semValue = [$this->semStack[$stackPos-(1-1)]]; |
||
| 143 | }, |
||
| 144 | 5 => function ($stackPos) { |
||
| 145 | $tags = $this->semStack[$stackPos-(2-1)]; $tags[] = $this->semStack[$stackPos-(2-2)]; $this->semValue = $tags; |
||
| 146 | }, |
||
| 147 | 6 => function ($stackPos) { |
||
| 148 | $this->semValue = new AST\Tag($this->semStack[$stackPos-(3-3)]); |
||
| 149 | }, |
||
| 150 | 7 => function ($stackPos) { |
||
| 151 | $this->semValue = new AST\Tag($this->semStack[$stackPos-(5-3)], $this->semStack[$stackPos-(5-5)]); |
||
| 152 | }, |
||
| 153 | 8 => function ($stackPos) { |
||
| 154 | $this->semValue = $this->semStack[$stackPos-(2-2)]; |
||
| 155 | }, |
||
| 156 | 9 => function ($stackPos) { |
||
| 157 | $this->semValue = $this->semStack[$stackPos]; |
||
| 158 | }, |
||
| 159 | 10 => function ($stackPos) { |
||
| 160 | $this->semValue = $this->semStack[$stackPos]; |
||
| 161 | }, |
||
| 162 | 11 => function ($stackPos) { |
||
| 163 | $this->semValue = $this->semStack[$stackPos]; |
||
| 164 | }, |
||
| 165 | 12 => function ($stackPos) { |
||
| 166 | $this->semValue = $this->semStack[$stackPos]; |
||
| 167 | }, |
||
| 168 | 13 => function ($stackPos) { |
||
| 169 | $this->semValue = $this->semStack[$stackPos-(2-1)] . $this->semStack[$stackPos-(2-2)]; |
||
| 170 | }, |
||
| 171 | 14 => function ($stackPos) { |
||
| 172 | $this->semValue = $this->semStack[$stackPos]; |
||
| 173 | }, |
||
| 174 | 15 => function ($stackPos) { |
||
| 175 | $this->semValue = $this->semStack[$stackPos]; |
||
| 176 | }, |
||
| 177 | 16 => function ($stackPos) { |
||
| 178 | $this->semValue = $this->semStack[$stackPos]; |
||
| 179 | }, |
||
| 180 | ]; |
||
| 181 | } |
||
| 182 | } |
||
| 183 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.