1 | <?php |
||
30 | class LdapUserProvider implements UserProviderInterface |
||
31 | { |
||
32 | /** |
||
33 | * @var LdapManager |
||
34 | */ |
||
35 | protected $ldap; |
||
36 | |||
37 | /** |
||
38 | * @var EventDispatcherInterface |
||
39 | */ |
||
40 | protected $dispatcher; |
||
41 | |||
42 | /** |
||
43 | * @var LdapRoleMapper |
||
44 | */ |
||
45 | protected $roleMapper; |
||
46 | |||
47 | /** |
||
48 | * @var array Default attributes selected for the Advanced User Interface. |
||
49 | */ |
||
50 | protected $defaultAttributes = [ |
||
51 | 'username', |
||
52 | 'guid', |
||
53 | 'accountExpirationDate', |
||
54 | 'enabled', |
||
55 | 'groups', |
||
56 | 'locked', |
||
57 | 'passwordMustChange', |
||
58 | ]; |
||
59 | |||
60 | /** |
||
61 | * @var array |
||
62 | */ |
||
63 | protected $options = [ |
||
64 | 'refresh_user_roles' => false, |
||
65 | 'refresh_user_attributes' => false, |
||
66 | 'search_base' => null, |
||
67 | 'ldap_object_type' => 'user', |
||
68 | 'user' => LdapUser::class, |
||
69 | 'additional_attributes' => [], |
||
70 | ]; |
||
71 | |||
72 | /** |
||
73 | * @param LdapManager $ldap |
||
74 | * @param EventDispatcherInterface $dispatcher |
||
75 | * @param LdapRoleMapper $roleMapper |
||
76 | * @param array $options |
||
77 | */ |
||
78 | public function __construct(LdapManager $ldap, EventDispatcherInterface $dispatcher, LdapRoleMapper $roleMapper, array $options) |
||
85 | |||
86 | /** |
||
87 | * {@inheritdoc} |
||
88 | */ |
||
89 | public function loadUserByUsername($username) |
||
99 | |||
100 | /** |
||
101 | * {@inheritdoc} |
||
102 | */ |
||
103 | public function refreshUser(UserInterface $user) |
||
121 | |||
122 | /** |
||
123 | * {@inheritdoc} |
||
124 | */ |
||
125 | public function supportsClass($class) |
||
129 | |||
130 | /** |
||
131 | * Search for, and return, the LDAP user by a specific attribute. |
||
132 | * |
||
133 | * @param string $attribute |
||
134 | * @param string $value |
||
135 | * @return LdapObject |
||
136 | */ |
||
137 | protected function getLdapUser($attribute, $value) |
||
154 | |||
155 | /** |
||
156 | * Get all the attributes that should be selected for when querying LDAP. |
||
157 | * |
||
158 | * @return array |
||
159 | */ |
||
160 | protected function getAttributesToSelect() |
||
167 | |||
168 | /** |
||
169 | * @param LdapObject $ldapObject |
||
170 | * @return LdapUserInterface |
||
171 | */ |
||
172 | protected function constructUserClass(LdapObject $ldapObject) |
||
201 | |||
202 | /** |
||
203 | * @param LdapObject $ldapObject |
||
204 | * @param $user |
||
205 | */ |
||
206 | protected function hydrateLdapObjectUser(LdapObject $ldapObject, LdapObject $user) |
||
217 | } |
||
218 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: