|
37 | 37 | use function array_keys; |
38 | 38 | use function array_map; |
39 | 39 | use function array_merge; |
| 40 | +use function array_slice; |
40 | 41 | use function array_unique; |
41 | 42 | use function count; |
42 | 43 | use function dirname; |
@@ -337,20 +338,23 @@ private function validateParameters(array $parameters, array $parametersSchema): |
337 | 338 | continue; |
338 | 339 | } |
339 | 340 |
|
340 | | - $atLeastOneOf = ['message', 'messages', 'rawMessage', 'identifier', 'identifiers', 'path', 'paths']; |
| 341 | + $atLeastOneOf = ['message', 'messages', 'rawMessage', 'rawMessages', 'identifier', 'identifiers', 'path', 'paths']; |
341 | 342 | if (array_intersect($atLeastOneOf, array_keys($ignoreError)) === []) { |
342 | 343 | throw new InvalidIgnoredErrorException('An ignoreErrors entry must contain at least one of the following fields: ' . implode(', ', $atLeastOneOf) . '.'); |
343 | 344 | } |
344 | 345 |
|
345 | 346 | foreach ([ |
346 | | - ['message', 'messages'], |
347 | | - ['rawMessage', 'message'], |
348 | | - ['rawMessage', 'messages'], |
| 347 | + ['rawMessage', 'rawMessages', 'message', 'messages'], |
349 | 348 | ['identifier', 'identifiers'], |
350 | 349 | ['path', 'paths'], |
351 | | - ] as [$field1, $field2]) { |
352 | | - if (array_key_exists($field1, $ignoreError) && array_key_exists($field2, $ignoreError)) { |
353 | | - throw new InvalidIgnoredErrorException(sprintf('An ignoreErrors entry cannot contain both %s and %s fields.', $field1, $field2)); |
| 350 | + ] as $incompatibleFields) { |
| 351 | + foreach ($incompatibleFields as $index => $field1) { |
| 352 | + $fieldsToCheck = array_slice($incompatibleFields, $index + 1); |
| 353 | + foreach ($fieldsToCheck as $field2) { |
| 354 | + if (array_key_exists($field1, $ignoreError) && array_key_exists($field2, $ignoreError)) { |
| 355 | + throw new InvalidIgnoredErrorException(sprintf('An ignoreErrors entry cannot contain both %s and %s fields.', $field1, $field2)); |
| 356 | + } |
| 357 | + } |
354 | 358 | } |
355 | 359 | } |
356 | 360 |
|
|
0 commit comments