| Conditions | 3 |
| Paths | 1 |
| Total Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 30 | public function withValidator($validator): void |
||
| 31 | { |
||
| 32 | $validator->after(function ($validator) { |
||
| 33 | if (! auth()->guard($this->route('guard'))->getProvider()->validateCredentials($this->user($this->route('guard')), ['password' => $this->get('old_password')])) { |
||
|
|
|||
| 34 | $validator->errors()->add('old_password', trans('cortex/auth::messages.account.wrong_password')); |
||
| 35 | } |
||
| 36 | |||
| 37 | if (auth()->guard($this->route('guard'))->getProvider()->validateCredentials($this->user($this->route('guard')), ['password' => $this->get('new_password')])) { |
||
| 38 | $validator->errors()->add('new_password', trans('cortex/auth::messages.account.different_password')); |
||
| 39 | } |
||
| 40 | }); |
||
| 41 | } |
||
| 42 | |||
| 56 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: