Total Complexity | 3 |
Total Lines | 31 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 0 |
1 | <?php |
||
12 | trait ValidateTrait |
||
13 | { |
||
14 | /** |
||
15 | * @param array $attributes |
||
16 | * @param array $rules |
||
17 | * |
||
18 | * @throws ValidationException |
||
19 | * |
||
20 | * @return void |
||
21 | */ |
||
22 | public static function validate(array $attributes, array $rules) |
||
23 | { |
||
24 | /** @var Validator $validator */ |
||
25 | $validator = static::getValidatorFactory()->make($attributes, $rules); |
||
26 | if (true === $validator->fails()) { |
||
27 | $message = $validator->messages()->first(); |
||
28 | |||
29 | $exception = new ValidationException(); |
||
30 | $exception->statusMessage = $exception->statusMessage . ': ' . $message; |
||
31 | $exception->validation = $validator->messages(); |
||
|
|||
32 | |||
33 | throw $exception; |
||
34 | } |
||
35 | } |
||
36 | |||
37 | /** |
||
38 | * @return ValidatorFactory |
||
39 | */ |
||
40 | protected static function getValidatorFactory() |
||
43 | } |
||
44 | } |
||
45 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..