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 | 18 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 13 |
CRAP Score | 3 |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
12 | 26 | public function onErrorFormatting(ErrorFormattingEvent $event): void |
|
13 | { |
||
14 | 26 | $error = $event->getError()->getPrevious(); |
|
15 | |||
16 | 26 | if ($error instanceof ArgumentsValidationException) { |
|
17 | 4 | $state = []; |
|
18 | 4 | $code = []; |
|
19 | |||
20 | 4 | $violations = $error->getViolations(); |
|
21 | 4 | foreach ($violations as $violation) { |
|
22 | 4 | $state[$violation->getPropertyPath()][] = $violation->getMessage(); |
|
23 | 4 | $code[$violation->getPropertyPath()][] = $violation->getCode(); |
|
24 | } |
||
25 | |||
26 | 4 | $formattedError = $event->getFormattedError(); |
|
27 | 4 | $formattedError->offsetSet('state', $state); |
|
28 | 4 | $formattedError->offsetSet('code', $code); |
|
29 | 4 | $formattedError->offsetUnset('locations'); |
|
30 | } |
||
33 |