We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| Conditions | 2 |
| Paths | 2 |
| Total Lines | 23 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 23 | public function show($id) |
||
| 24 | { |
||
| 25 | |||
| 26 | $donor = Donor::find($id); |
||
| 27 | |||
| 28 | if (! $donor) { |
||
| 29 | return response()->json( |
||
| 30 | [ |
||
| 31 | 'error_code' => 404, |
||
| 32 | 'error_message' => 'Donor not found!' |
||
| 33 | ], 404 |
||
| 34 | ); |
||
| 35 | } |
||
| 36 | |||
| 37 | return response()->json( |
||
| 38 | [ |
||
| 39 | 'first_name' => $donor->user->first_name, |
||
| 40 | 'last_name' => $donor->user->last_name, |
||
| 41 | 'email' => $donor->user->email, |
||
| 42 | 'birthdate' => $donor->user->birthdate, |
||
| 43 | ] |
||
| 44 | ); |
||
| 45 | } |
||
| 46 | |||
| 59 |
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: