| Conditions | 1 |
| Paths | 1 |
| Total Lines | 9 |
| Lines | 9 |
| Ratio | 100 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 25 | View Code Duplication | public function rules() |
|
| 26 | { |
||
| 27 | return [ |
||
| 28 | 'name' => ['required', 'string'], |
||
| 29 | 'email' => ['required', 'string', 'unique:users'], |
||
| 30 | 'password' => ['required', 'string', 'min:8', 'confirmed'], |
||
| 31 | 'role_id' => ['required', 'string', 'exists:roles,id'], |
||
| 32 | ]; |
||
| 33 | } |
||
| 34 | |||
| 45 |
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: