1 | <?php |
||
9 | class ArrayValidator extends AbstractValidator |
||
10 | { |
||
11 | /** |
||
12 | * ArrayValidator constructor. |
||
13 | * @param Comfort $comfort |
||
14 | */ |
||
15 | public function __construct(Comfort $comfort) |
||
21 | |||
22 | /** |
||
23 | * Given a set of keys apply the specified validation rules |
||
24 | * |
||
25 | * @param array $definition |
||
26 | * @return $this |
||
27 | */ |
||
28 | public function keys(array $definition) |
||
51 | |||
52 | /** |
||
53 | * Validate array has more than $min elements |
||
54 | * |
||
55 | * @param $min |
||
56 | * @return $this |
||
57 | */ |
||
58 | public function min($min) |
||
66 | |||
67 | /** |
||
68 | * Validate array has only up to $max characters |
||
69 | * |
||
70 | * @param $max |
||
71 | * @return $this |
||
72 | */ |
||
73 | public function max($max) |
||
81 | |||
82 | /** |
||
83 | * Validate array contains exactly $length elements |
||
84 | * |
||
85 | * @param $length |
||
86 | * @return $this |
||
87 | */ |
||
88 | public function length($length) |
||
96 | |||
97 | /** |
||
98 | * Validate array is unique |
||
99 | * |
||
100 | * @return $this |
||
101 | */ |
||
102 | public function unique() |
||
110 | |||
111 | /** |
||
112 | * Apply $definition to individual items in the array, |
||
113 | * used in case of multi-dimensional array |
||
114 | * |
||
115 | * @param AbstractValidator $definition |
||
116 | * @return $this |
||
117 | */ |
||
118 | public function items(AbstractValidator $definition) |
||
137 | } |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: