1 | <?php |
||
12 | class AclService implements AclServiceInterface |
||
13 | { |
||
14 | /** |
||
15 | * @param \Napp\Core\Acl\Contract\Role|null $user |
||
16 | * @param array|string $roles |
||
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 | * @return bool |
||
42 | */ |
||
43 | 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 | * @return bool |
||
77 | */ |
||
78 | 10 | public function hasAnyPermission(array $permissions, ?Role $user = null): bool |
|
89 | |||
90 | /** |
||
91 | * @param array $permissions |
||
92 | * @param \Napp\Core\Acl\Contract\Role|null $user |
||
93 | * @return bool |
||
94 | */ |
||
95 | 8 | public function hasAllPermissions(array $permissions, ?Role $user = null): bool |
|
106 | |||
107 | /** |
||
108 | * @return array |
||
109 | */ |
||
110 | 2 | public function allPermissions(): array |
|
114 | |||
115 | /** |
||
116 | * @param \Napp\Core\Acl\Contract\Role|null $user |
||
117 | * @return array |
||
118 | */ |
||
119 | 10 | public function getUserPermissions(?Role $user = null): array |
|
140 | |||
141 | /** |
||
142 | * @param string|array $permission |
||
143 | * @return bool |
||
144 | */ |
||
145 | 34 | public function may($permission): bool |
|
155 | |||
156 | /** |
||
157 | * @param string|array $permission |
||
158 | * @return bool |
||
159 | */ |
||
160 | 6 | public function maynot($permission): bool |
|
164 | |||
165 | /** |
||
166 | * @param array $permissions |
||
167 | * @return bool |
||
168 | */ |
||
169 | 2 | public function mayall(array $permissions): bool |
|
173 | } |
||
174 |
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: