1 | <?php |
||
11 | class AclService implements AclServiceInterface |
||
12 | { |
||
13 | /** |
||
14 | * @param \Napp\Core\Acl\Contract\Role|null $user |
||
15 | * @param array|string $roles |
||
16 | * |
||
17 | * @return bool |
||
18 | */ |
||
19 | 14 | public function userHasRole(?Role $user, $roles): bool |
|
37 | |||
38 | /** |
||
39 | * @param string $permission |
||
40 | * @param \Napp\Core\Acl\Contract\Role|null $user |
||
41 | * |
||
42 | * @return bool |
||
43 | */ |
||
44 | 44 | public function hasPermission(string $permission, ?Role $user = null): bool |
|
72 | |||
73 | /** |
||
74 | * @param array $permissions |
||
75 | * @param \Napp\Core\Acl\Contract\Role|null $user |
||
76 | * |
||
77 | * @return bool |
||
78 | */ |
||
79 | 10 | public function hasAnyPermission(array $permissions, ?Role $user = null): bool |
|
90 | |||
91 | /** |
||
92 | * @param array $permissions |
||
93 | * @param \Napp\Core\Acl\Contract\Role|null $user |
||
94 | * |
||
95 | * @return bool |
||
96 | */ |
||
97 | 8 | public function hasAllPermissions(array $permissions, ?Role $user = null): bool |
|
108 | |||
109 | /** |
||
110 | * @return array |
||
111 | */ |
||
112 | 2 | public function allPermissions(): array |
|
116 | |||
117 | /** |
||
118 | * @param \Napp\Core\Acl\Contract\Role|null $user |
||
119 | * |
||
120 | * @return array |
||
121 | */ |
||
122 | 10 | public function getUserPermissions(?Role $user = null): array |
|
143 | |||
144 | /** |
||
145 | * @param string|array $permission |
||
146 | * |
||
147 | * @return bool |
||
148 | */ |
||
149 | 34 | public function may($permission): bool |
|
159 | |||
160 | /** |
||
161 | * @param string|array $permission |
||
162 | * |
||
163 | * @return bool |
||
164 | */ |
||
165 | 6 | public function maynot($permission): bool |
|
169 | |||
170 | /** |
||
171 | * @param array $permissions |
||
172 | * |
||
173 | * @return bool |
||
174 | */ |
||
175 | 2 | public function mayall(array $permissions): bool |
|
179 | } |
||
180 |
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: