1 | <?php |
||
10 | trait TwoFactorAuthenticatesUsers |
||
11 | { |
||
12 | /** |
||
13 | * Verify TwoFactor authentication. |
||
14 | * |
||
15 | * @param \Rinvex\Auth\Contracts\AuthenticatableTwoFactorContract $user |
||
16 | * @param int $token |
||
17 | * |
||
18 | * @return bool |
||
19 | */ |
||
20 | protected function attemptTwoFactor(AuthenticatableTwoFactorContract $user, int $token): bool |
||
24 | |||
25 | /** |
||
26 | * Invalidate given backup code for the given user. |
||
27 | * |
||
28 | * @param \Rinvex\Auth\Contracts\AuthenticatableTwoFactorContract $user |
||
29 | * @param int $token |
||
30 | * |
||
31 | * @return void |
||
32 | */ |
||
33 | protected function invalidateTwoFactorBackup(AuthenticatableTwoFactorContract $user, int $token): void |
||
45 | |||
46 | /** |
||
47 | * Determine if the given token is a valid TwoFactor Phone token. |
||
48 | * |
||
49 | * @param \Rinvex\Auth\Contracts\AuthenticatableTwoFactorContract $user |
||
50 | * @param int $token |
||
51 | * |
||
52 | * @return bool |
||
53 | */ |
||
54 | protected function isValidTwoFactorPhone(AuthenticatableTwoFactorContract $user, int $token): bool |
||
61 | |||
62 | /** |
||
63 | * Determine if the given token is a valid TwoFactor Backup code. |
||
64 | * |
||
65 | * @param \Rinvex\Auth\Contracts\AuthenticatableTwoFactorContract $user |
||
66 | * @param int $token |
||
67 | * |
||
68 | * @return bool |
||
69 | */ |
||
70 | protected function isValidTwoFactorBackup(AuthenticatableTwoFactorContract $user, int $token): bool |
||
78 | |||
79 | /** |
||
80 | * Determine if the given token is a valid TwoFactor TOTP token. |
||
81 | * |
||
82 | * @param \Rinvex\Auth\Contracts\AuthenticatableTwoFactorContract $user |
||
83 | * @param int $token |
||
84 | * |
||
85 | * @return bool |
||
86 | */ |
||
87 | protected function isValidTwoFactorTotp(AuthenticatableTwoFactorContract $user, int $token): bool |
||
94 | } |
||
95 |
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.