1 | <?php |
||
23 | class LoginForm extends Model |
||
24 | { |
||
25 | use ModuleAwareTrait; |
||
26 | |||
27 | /** |
||
28 | * @var string login User's email or username |
||
29 | */ |
||
30 | public $login; |
||
31 | /** |
||
32 | * @var string User's password |
||
33 | */ |
||
34 | public $password; |
||
35 | /** |
||
36 | * @var string User's two-factor authentication code |
||
37 | */ |
||
38 | public $twoFactorAuthenticationCode; |
||
39 | /** |
||
40 | * @var bool whether to remember User's login |
||
41 | */ |
||
42 | public $rememberMe = false; |
||
43 | /** |
||
44 | * @var User |
||
45 | */ |
||
46 | protected $user; |
||
47 | /** |
||
48 | * @var UserQuery |
||
49 | */ |
||
50 | protected $query; |
||
51 | /** |
||
52 | * @var SecurityHelper |
||
53 | */ |
||
54 | protected $securityHelper; |
||
55 | |||
56 | /** |
||
57 | * @param UserQuery $query |
||
58 | * @param SecurityHelper $securityHelper |
||
59 | * @param array $config |
||
60 | */ |
||
61 | 4 | public function __construct(UserQuery $query, SecurityHelper $securityHelper, $config = []) |
|
67 | |||
68 | /** |
||
69 | * {@inheritdoc} |
||
70 | */ |
||
71 | 4 | public function attributeLabels() |
|
80 | |||
81 | /** |
||
82 | * {@inheritdoc} |
||
83 | * |
||
84 | * @throws \Da\TwoFA\Exception\InvalidSecretKeyException (only if package is being used) |
||
85 | */ |
||
86 | 4 | public function rules() |
|
139 | |||
140 | /** |
||
141 | * Validates form and logs the user in. |
||
142 | * |
||
143 | * @throws InvalidParamException |
||
144 | * @return bool whether the user is logged in successfully |
||
145 | */ |
||
146 | 4 | public function login() |
|
156 | |||
157 | /** |
||
158 | * {@inheritdoc} |
||
159 | */ |
||
160 | 4 | public function beforeValidate() |
|
170 | |||
171 | /** |
||
172 | * @return User |
||
173 | */ |
||
174 | 4 | public function getUser() |
|
178 | } |
||
179 |
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: