| Conditions | 1 |
| Paths | 1 |
| Total Lines | 115 |
| 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 |
||
| 115 | public function noAssociationData(): array |
||
| 116 | { |
||
| 117 | return [ |
||
| 118 | 'array' => [ |
||
| 119 | $array = 'array', |
||
| 120 | $array, |
||
| 121 | Guess::HIGH_CONFIDENCE, |
||
| 122 | ], |
||
| 123 | 'simple_array' => [ |
||
| 124 | 'simple_array', |
||
| 125 | $array, |
||
| 126 | Guess::HIGH_CONFIDENCE, |
||
| 127 | ], |
||
| 128 | 'json_array' => [ |
||
| 129 | 'json_array', |
||
| 130 | $array, |
||
| 131 | Guess::HIGH_CONFIDENCE, |
||
| 132 | ], |
||
| 133 | 'json' => [ |
||
| 134 | 'json', |
||
| 135 | $array, |
||
| 136 | Guess::HIGH_CONFIDENCE, |
||
| 137 | ], |
||
| 138 | 'boolean' => [ |
||
| 139 | $boolean = 'boolean', |
||
| 140 | $boolean, |
||
| 141 | Guess::HIGH_CONFIDENCE, |
||
| 142 | ], |
||
| 143 | 'datetime' => [ |
||
| 144 | $datetime = 'datetime', |
||
| 145 | $datetime, |
||
| 146 | Guess::HIGH_CONFIDENCE, |
||
| 147 | ], |
||
| 148 | 'datetime_immutable' => [ |
||
| 149 | 'datetime_immutable', |
||
| 150 | $datetime, |
||
| 151 | Guess::HIGH_CONFIDENCE, |
||
| 152 | ], |
||
| 153 | 'vardatetime' => [ |
||
| 154 | 'vardatetime', |
||
| 155 | $datetime, |
||
| 156 | Guess::HIGH_CONFIDENCE, |
||
| 157 | ], |
||
| 158 | 'datetimetz' => [ |
||
| 159 | 'datetimetz', |
||
| 160 | $datetime, |
||
| 161 | Guess::HIGH_CONFIDENCE, |
||
| 162 | ], |
||
| 163 | 'datetimetz_immutable' => [ |
||
| 164 | 'datetimetz_immutable', |
||
| 165 | $datetime, |
||
| 166 | Guess::HIGH_CONFIDENCE, |
||
| 167 | ], |
||
| 168 | 'date' => [ |
||
| 169 | $date = 'date', |
||
| 170 | $date, |
||
| 171 | Guess::HIGH_CONFIDENCE, |
||
| 172 | ], |
||
| 173 | 'date_immutable' => [ |
||
| 174 | 'date_immutable', |
||
| 175 | $date, |
||
| 176 | Guess::HIGH_CONFIDENCE, |
||
| 177 | ], |
||
| 178 | 'decimal' => [ |
||
| 179 | 'decimal', |
||
| 180 | $number = 'number', |
||
| 181 | Guess::MEDIUM_CONFIDENCE, |
||
| 182 | ], |
||
| 183 | 'float' => [ |
||
| 184 | 'float', |
||
| 185 | $number, |
||
| 186 | Guess::MEDIUM_CONFIDENCE, |
||
| 187 | ], |
||
| 188 | 'integer' => [ |
||
| 189 | $integer = 'integer', |
||
| 190 | $integer, |
||
| 191 | Guess::MEDIUM_CONFIDENCE, |
||
| 192 | ], |
||
| 193 | 'bigint' => [ |
||
| 194 | 'bigint', |
||
| 195 | $integer, |
||
| 196 | Guess::MEDIUM_CONFIDENCE, |
||
| 197 | ], |
||
| 198 | 'smallint' => [ |
||
| 199 | 'smallint', |
||
| 200 | $integer, |
||
| 201 | Guess::MEDIUM_CONFIDENCE, |
||
| 202 | ], |
||
| 203 | 'string' => [ |
||
| 204 | 'string', |
||
| 205 | $text = 'text', |
||
| 206 | Guess::MEDIUM_CONFIDENCE, |
||
| 207 | ], |
||
| 208 | 'text' => [ |
||
| 209 | 'text', |
||
| 210 | 'textarea', |
||
| 211 | Guess::MEDIUM_CONFIDENCE, |
||
| 212 | ], |
||
| 213 | 'time' => [ |
||
| 214 | $time = 'time', |
||
| 215 | $time, |
||
| 216 | Guess::HIGH_CONFIDENCE, |
||
| 217 | ], |
||
| 218 | 'time_immutable' => [ |
||
| 219 | 'time_immutable', |
||
| 220 | $time, |
||
| 221 | Guess::HIGH_CONFIDENCE, |
||
| 222 | ], |
||
| 223 | 'somefake' => [ |
||
| 224 | 'somefake', |
||
| 225 | $text, |
||
| 226 | Guess::LOW_CONFIDENCE, |
||
| 227 | ], |
||
| 228 | ]; |
||
| 229 | } |
||
| 230 | } |
||
| 231 |