We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| Conditions | 1 |
| Paths | 1 |
| Total Lines | 105 |
| Code Lines | 43 |
| 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 |
||
| 194 | public function parentExceptionMappingDataProvider() |
||
| 195 | { |
||
| 196 | return [ |
||
| 197 | 'without $mapToParentExceptions and only the exact class, maps to exact class' => [ |
||
| 198 | [ |
||
| 199 | ChildOfInvalidArgumentException::class => UserError::class, |
||
| 200 | ], |
||
| 201 | true, |
||
| 202 | [ |
||
| 203 | 'errors' => [ |
||
| 204 | [ |
||
| 205 | 'message' => 'Error with invalid argument exception', |
||
| 206 | ], |
||
| 207 | ], |
||
| 208 | ], |
||
| 209 | ], |
||
| 210 | 'without $mapToParentExceptions and only the parent class, does not map to parent' => [ |
||
| 211 | [ |
||
| 212 | \InvalidArgumentException::class => UserWarning::class, |
||
| 213 | ], |
||
| 214 | true, |
||
| 215 | [ |
||
| 216 | 'extensions' => [ |
||
| 217 | 'warnings' => [ |
||
| 218 | [ |
||
| 219 | 'message' => 'Error with invalid argument exception', |
||
| 220 | ], |
||
| 221 | ], |
||
| 222 | ], |
||
| 223 | ], |
||
| 224 | ], |
||
| 225 | 'with $mapToParentExceptions and only the exact class' => [ |
||
| 226 | [ |
||
| 227 | ChildOfInvalidArgumentException::class => UserError::class, |
||
| 228 | ], |
||
| 229 | true, |
||
| 230 | [ |
||
| 231 | 'errors' => [ |
||
| 232 | [ |
||
| 233 | 'message' => 'Error with invalid argument exception', |
||
| 234 | ], |
||
| 235 | ], |
||
| 236 | ], |
||
| 237 | ], |
||
| 238 | 'with $mapToParentExceptions and only the parent class' => [ |
||
| 239 | [ |
||
| 240 | \InvalidArgumentException::class => UserWarning::class, |
||
| 241 | ], |
||
| 242 | true, |
||
| 243 | [ |
||
| 244 | 'extensions' => [ |
||
| 245 | 'warnings' => [ |
||
| 246 | [ |
||
| 247 | 'message' => 'Error with invalid argument exception', |
||
| 248 | ], |
||
| 249 | ], |
||
| 250 | ], |
||
| 251 | ], |
||
| 252 | ], |
||
| 253 | 'with $mapToParentExceptions and the exact class first matches exact class' => [ |
||
| 254 | [ |
||
| 255 | ChildOfInvalidArgumentException::class => UserError::class, |
||
| 256 | \InvalidArgumentException::class => UserWarning::class, |
||
| 257 | ], |
||
| 258 | true, |
||
| 259 | [ |
||
| 260 | 'errors' => [ |
||
| 261 | [ |
||
| 262 | 'message' => 'Error with invalid argument exception', |
||
| 263 | ], |
||
| 264 | ], |
||
| 265 | ], |
||
| 266 | ], |
||
| 267 | 'with $mapToParentExceptions and the exact class first but parent maps to error' => [ |
||
| 268 | [ |
||
| 269 | ChildOfInvalidArgumentException::class => UserWarning::class, |
||
| 270 | \InvalidArgumentException::class => UserError::class, |
||
| 271 | ], |
||
| 272 | true, |
||
| 273 | [ |
||
| 274 | 'extensions' => [ |
||
| 275 | 'warnings' => [ |
||
| 276 | [ |
||
| 277 | 'message' => 'Error with invalid argument exception', |
||
| 278 | ], |
||
| 279 | ], |
||
| 280 | ], |
||
| 281 | ], |
||
| 282 | ], |
||
| 283 | 'with $mapToParentExceptions and the parent class first still matches exact class' => [ |
||
| 284 | [ |
||
| 285 | \InvalidArgumentException::class => UserWarning::class, |
||
| 286 | ChildOfInvalidArgumentException::class => UserError::class, |
||
| 287 | ], |
||
| 288 | true, |
||
| 289 | [ |
||
| 290 | 'errors' => [ |
||
| 291 | [ |
||
| 292 | 'message' => 'Error with invalid argument exception', |
||
| 293 | ], |
||
| 294 | ], |
||
| 295 | ], |
||
| 296 | ], |
||
| 297 | ]; |
||
| 298 | } |
||
| 299 | } |
||
| 300 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: