1 | <?php namespace Arcanedev\LaravelAuth\Services; |
||
11 | class UserImpersonator |
||
12 | { |
||
13 | /* ------------------------------------------------------------------------------------------------ |
||
14 | | Main Functions |
||
15 | | ------------------------------------------------------------------------------------------------ |
||
16 | */ |
||
17 | /** |
||
18 | * Start the user impersonation. |
||
19 | * |
||
20 | * @param \Arcanesoft\Contracts\Auth\Models\User $user |
||
21 | * |
||
22 | * @return bool |
||
23 | */ |
||
24 | 9 | public static function start(User $user) |
|
32 | |||
33 | /** |
||
34 | * Stop the user impersonation. |
||
35 | */ |
||
36 | 9 | public static function stop() |
|
40 | |||
41 | /** |
||
42 | * Check if the impersonation is ongoing. |
||
43 | * |
||
44 | * @return bool |
||
45 | */ |
||
46 | 9 | public static function isImpersonating() |
|
50 | |||
51 | /** |
||
52 | * Check if the impersonation is enabled. |
||
53 | * |
||
54 | * @return bool |
||
55 | */ |
||
56 | 18 | public static function isEnabled() |
|
60 | |||
61 | /** |
||
62 | * Get the session key. |
||
63 | * |
||
64 | * @return string |
||
65 | */ |
||
66 | 9 | public static function getKey() |
|
70 | |||
71 | /** |
||
72 | * Get the user id. |
||
73 | * |
||
74 | * @return mixed |
||
75 | */ |
||
76 | 9 | public static function getUserId() |
|
80 | } |
||
81 |
If you access a property on an interface, you most likely code against a concrete implementation of the interface.
Available Fixes
Adding an additional type check:
Changing the type hint: