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