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 |
||
142 | public function noAssociationData(): array |
||
143 | { |
||
144 | return [ |
||
145 | 'collection' => [ |
||
146 | Type::COLLECTION, |
||
147 | 'array', |
||
148 | Guess::HIGH_CONFIDENCE, |
||
149 | ], |
||
150 | 'hash' => [ |
||
151 | Type::HASH, |
||
152 | 'array', |
||
153 | Guess::HIGH_CONFIDENCE, |
||
154 | ], |
||
155 | 'bool' => [ |
||
156 | Type::BOOL, |
||
157 | 'boolean', |
||
158 | Guess::HIGH_CONFIDENCE, |
||
159 | ], |
||
160 | 'timestamp' => [ |
||
161 | Type::TIMESTAMP, |
||
162 | 'datetime', |
||
163 | Guess::HIGH_CONFIDENCE, |
||
164 | ], |
||
165 | 'datetime_immutable' => [ |
||
166 | Type::DATE_IMMUTABLE, |
||
167 | 'date', |
||
168 | Guess::HIGH_CONFIDENCE, |
||
169 | ], |
||
170 | 'date' => [ |
||
171 | Type::DATE, |
||
172 | 'date', |
||
173 | Guess::HIGH_CONFIDENCE, |
||
174 | ], |
||
175 | 'float' => [ |
||
176 | Type::FLOAT, |
||
177 | 'number', |
||
178 | Guess::MEDIUM_CONFIDENCE, |
||
179 | ], |
||
180 | 'integer' => [ |
||
181 | Type::INT, |
||
182 | 'integer', |
||
183 | Guess::MEDIUM_CONFIDENCE, |
||
184 | ], |
||
185 | 'string' => [ |
||
186 | Type::STRING, |
||
187 | 'text', |
||
188 | Guess::MEDIUM_CONFIDENCE, |
||
189 | ], |
||
190 | 'somefake' => [ |
||
191 | 'somefake', |
||
192 | 'text', |
||
193 | Guess::LOW_CONFIDENCE, |
||
194 | ], |
||
195 | ]; |
||
196 | } |
||
197 | } |
||
198 |