| 1 | <?php namespace Arcanesoft\Auth\Helpers; |
||
| 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 | public static function start(User $user) |
||
| 32 | |||
| 33 | /** |
||
| 34 | * Stop the user impersonation. |
||
| 35 | */ |
||
| 36 | public static function stop() |
||
| 40 | |||
| 41 | /** |
||
| 42 | * Check if the impersonation is ongoing. |
||
| 43 | * |
||
| 44 | * @return bool |
||
| 45 | */ |
||
| 46 | public static function isImpersonating() |
||
| 50 | |||
| 51 | /** |
||
| 52 | * Check if the impersonation is enabled. |
||
| 53 | * |
||
| 54 | * @return bool |
||
| 55 | */ |
||
| 56 | public static function isEnabled() |
||
| 60 | } |
||
| 61 |
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: