Conditions | 3 |
Paths | 3 |
Total Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
14 | public function showWelcomeForm(Request $request, string $userId, string $token = null) |
||
15 | { |
||
16 | if (! $user = User::find($userId)) { |
||
17 | return $this->invalidLinkResponse(); |
||
18 | } |
||
19 | |||
20 | if (! $this->broker()->tokenExists($user, $token)) { |
||
21 | return $this->invalidLinkResponse(); |
||
22 | } |
||
23 | |||
24 | return view('welcomeNotification::welcome')->with([ |
||
|
|||
25 | 'token' => $token, |
||
26 | 'email' => $request->email, |
||
27 | 'user' => $user, |
||
28 | ]); |
||
29 | } |
||
30 | |||
51 |
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: