We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| Conditions | 3 |
| Paths | 3 |
| Total Lines | 19 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 3 |
| CRAP Score | 7.096 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 15 | 22 | public function onErrorFormatting(ErrorFormattingEvent $event): void |
|
| 16 | { |
||
| 17 | 22 | $error = $event->getError()->getPrevious(); |
|
| 18 | |||
| 19 | 22 | if($error instanceof ArgumentsValidationException) |
|
| 20 | { |
||
| 21 | $state = []; |
||
| 22 | $code = []; |
||
| 23 | |||
| 24 | $violations = $error->getViolations(); |
||
| 25 | foreach ($violations as $violation) { |
||
| 26 | $state[$violation->getPropertyPath()][] = $violation->getMessage(); |
||
| 27 | $code[$violation->getPropertyPath()][] = $violation->getCode(); |
||
| 28 | } |
||
| 29 | |||
| 30 | $formattedError = $event->getFormattedError(); |
||
| 31 | $formattedError->offsetSet('state', $state); |
||
| 32 | $formattedError->offsetSet('code', $code); |
||
| 33 | $formattedError->offsetUnset('locations'); |
||
| 34 | } |
||
| 38 |