Conditions | 1 |
Paths | 1 |
Total Lines | 68 |
Code Lines | 40 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
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 |
||
135 | public function validProvider(): array { |
||
136 | return [ |
||
137 | [ |
||
138 | [ |
||
139 | 'id' => 1, |
||
140 | ], |
||
141 | [ |
||
142 | 'pollId' => 1, |
||
143 | ], |
||
144 | ], |
||
145 | [ |
||
146 | [ |
||
147 | 'id' => 123, |
||
148 | '--user' => ['user1', 'user2'], |
||
149 | '--group' => ['group1'], |
||
150 | '--email' => ['[email protected]'], |
||
151 | ], |
||
152 | [ |
||
153 | 'pollId' => 123, |
||
154 | 'initialShares' => [ |
||
155 | 'user' => ['user1', 'user2', 'user3'], |
||
156 | 'group' => ['group1'], |
||
157 | 'email' => ['[email protected]', '[email protected]'], |
||
158 | ], |
||
159 | 'expectedShares' => [ |
||
160 | 'user' => ['user1', 'user2'], |
||
161 | 'group' => ['group1'], |
||
162 | 'email' => ['[email protected]'], |
||
163 | ], |
||
164 | ], |
||
165 | ], |
||
166 | [ |
||
167 | [ |
||
168 | 'id' => 456, |
||
169 | '--user' => ['user1', 'user2', 'user3', 'user4'], |
||
170 | '--email' => ['[email protected]', '[email protected]'], |
||
171 | ], |
||
172 | [ |
||
173 | 'pollId' => 456, |
||
174 | 'initialShares' => [ |
||
175 | 'user' => ['user2', 'user3'], |
||
176 | 'email' => ['[email protected]', '[email protected]'], |
||
177 | 'contact' => ['[email protected]'], |
||
178 | ], |
||
179 | 'expectedShares' => [ |
||
180 | 'user' => ['user2', 'user3'], |
||
181 | 'email' => ['[email protected]'], |
||
182 | 'contact' => ['[email protected]'], |
||
183 | ], |
||
184 | ] |
||
185 | ], |
||
186 | [ |
||
187 | [ |
||
188 | 'id' => 789, |
||
189 | '--group' => ['group1'], |
||
190 | '--email' => ['[email protected]', '[email protected]'], |
||
191 | ], |
||
192 | [ |
||
193 | 'pollId' => 789, |
||
194 | 'initialShares' => [ |
||
195 | 'user' => ['user1', 'user2'], |
||
196 | 'email' => ['[email protected]'], |
||
197 | 'contact' => ['[email protected]'], |
||
198 | 'external' => ['[email protected]'], |
||
199 | ], |
||
200 | 'expectedShares' => [ |
||
201 | 'email' => ['[email protected]'], |
||
202 | 'external' => ['[email protected]'], |
||
203 | ], |
||
209 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.