1 | <?php |
||
20 | trait LoggedUser |
||
21 | { |
||
22 | /** |
||
23 | * @var mixed |
||
24 | */ |
||
25 | protected $loggedUser; |
||
26 | |||
27 | /** |
||
28 | * @var Guard |
||
29 | */ |
||
30 | protected $auth; |
||
31 | |||
32 | protected function setAuth(Guard $auth) |
||
38 | |||
39 | /** |
||
40 | * Return instance of the logged user. |
||
41 | * |
||
42 | * @param mixed $user |
||
43 | * |
||
44 | * @return $this |
||
45 | */ |
||
46 | public function setLoggedUser($user) |
||
52 | |||
53 | protected function isLoggedIn() |
||
59 | |||
60 | /** |
||
61 | * Is current logged in user with role User. |
||
62 | * |
||
63 | * @return bool |
||
64 | */ |
||
65 | protected function isLoggedNormalUser() |
||
69 | |||
70 | /** |
||
71 | * Inject the instance of logged user. |
||
72 | * |
||
73 | * @return void |
||
74 | */ |
||
75 | protected function lazyLoadLoggedUser() |
||
85 | |||
86 | /** |
||
87 | * Return instance of the logged user. |
||
88 | * |
||
89 | * @return User |
||
90 | */ |
||
91 | public function getLoggedUser() |
||
102 | } |
||
103 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.