| Conditions | 2 |
| Paths | 2 |
| Total Lines | 22 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 19 | public function render() |
||
| 20 | { |
||
| 21 | if ($this->validator->errors()->first() == 'validation.in') { |
||
| 22 | return response()->json([ |
||
|
|
|||
| 23 | 'code' => 'INVALID_GENDER', |
||
| 24 | 'validationResult' => [ |
||
| 25 | 'resultType' => 'INVALID_GENDER', |
||
| 26 | 'valid' => false, |
||
| 27 | ], |
||
| 28 | ]); |
||
| 29 | } |
||
| 30 | |||
| 31 | return response()->json([ |
||
| 32 | 'code' => 'INVALID_NAME', |
||
| 33 | 'validationResult' => [ |
||
| 34 | 'resultType' => 'VALIDATION_ERROR_UNKNOWN', |
||
| 35 | 'additionalInfo' => null, |
||
| 36 | 'valid' => false, |
||
| 37 | ], |
||
| 38 | 'suggestions' => [], |
||
| 39 | ]); |
||
| 40 | } |
||
| 41 | } |
||
| 42 |
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: