1 | <?php |
||
14 | class Validator |
||
15 | { |
||
16 | use AccessProtectedTrait; |
||
17 | use RuleListTrait; |
||
18 | |||
19 | /** |
||
20 | * Validator extension name. |
||
21 | */ |
||
22 | const EXTENSION_NAME = 'jsvalidation'; |
||
23 | |||
24 | /** |
||
25 | * @var \Illuminate\Validation\Validator |
||
26 | */ |
||
27 | protected $validator; |
||
28 | |||
29 | /** |
||
30 | * RemoteValidator constructor. |
||
31 | * |
||
32 | * @param \Illuminate\Validation\Validator $validator |
||
33 | */ |
||
34 | 60 | public function __construct(BaseValidator $validator) |
|
38 | |||
39 | /** |
||
40 | * Validate request. |
||
41 | * |
||
42 | * @param $field |
||
43 | * @param $parameters |
||
44 | * @return void |
||
45 | * |
||
46 | * @throws \Illuminate\Validation\ValidationException |
||
47 | */ |
||
48 | 60 | public function validate($field, $parameters = []) |
|
56 | |||
57 | /** |
||
58 | * Throw the failed validation exception. |
||
59 | * |
||
60 | * @param mixed $result |
||
61 | * @param \Illuminate\Validation\Validator $validator |
||
62 | * @return void |
||
63 | * |
||
64 | * @throws \Illuminate\Validation\ValidationException|\Illuminate\Http\Exceptions\HttpResponseException |
||
65 | */ |
||
66 | 60 | protected function throwValidationException($result, $validator) |
|
76 | |||
77 | /** |
||
78 | * Parse Validation input request data. |
||
79 | * |
||
80 | * @param $data |
||
81 | * @return array |
||
82 | */ |
||
83 | 60 | protected function parseAttributeName($data) |
|
91 | |||
92 | /** |
||
93 | * Parse Validation parameters. |
||
94 | * |
||
95 | * @param $parameters |
||
96 | * @return array |
||
97 | */ |
||
98 | 60 | protected function parseParameters($parameters) |
|
107 | |||
108 | /** |
||
109 | * Validate remote Javascript Validations. |
||
110 | * |
||
111 | * @param $attribute |
||
112 | * @param array $parameters |
||
113 | * @return array|bool |
||
114 | */ |
||
115 | 60 | protected function validateJsRemoteRequest($attribute, $parameters) |
|
126 | |||
127 | /** |
||
128 | * Sets data for validate remote rules. |
||
129 | * |
||
130 | * @param $attribute |
||
131 | * @param bool $validateAll |
||
132 | * @return void |
||
133 | */ |
||
134 | 60 | protected function setRemoteValidation($attribute, $validateAll = false) |
|
149 | |||
150 | /** |
||
151 | * Remove rules that should not be validated remotely. |
||
152 | * |
||
153 | * @param $rules |
||
154 | * @param BaseValidator $validator |
||
155 | * @return mixed |
||
156 | */ |
||
157 | 36 | protected function purgeNonRemoteRules($rules, $validator) |
|
170 | } |
||
171 |
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: