1 | <?php |
||
28 | class Permission extends MiddlewareAbstract |
||
29 | { |
||
30 | /** |
||
31 | * List of permissions that can be accessed by public users. |
||
32 | * |
||
33 | * @var array |
||
34 | */ |
||
35 | protected $publicAccess = [ |
||
36 | 'issue-view', |
||
37 | ]; |
||
38 | |||
39 | /** |
||
40 | * Ordered list of contexts. |
||
41 | * |
||
42 | * @var array |
||
43 | */ |
||
44 | protected $contexts = [ |
||
45 | 'comment', |
||
46 | 'attachment', |
||
47 | 'issue', |
||
48 | 'project', |
||
49 | ]; |
||
50 | |||
51 | /** |
||
52 | * Handle an incoming request. |
||
53 | * |
||
54 | * @param Request $request |
||
55 | * @param \Closure $next |
||
56 | * |
||
57 | * @return mixed |
||
58 | */ |
||
59 | 44 | public function handle(Request $request, Closure $next) |
|
70 | |||
71 | /** |
||
72 | * Whether or not the current context is in public project. |
||
73 | * |
||
74 | * @param Request $request |
||
75 | * @param string $permission |
||
76 | * |
||
77 | * @return bool |
||
78 | */ |
||
79 | 44 | protected function isInPublicProjectContext(Request $request, $permission) |
|
89 | |||
90 | /** |
||
91 | * Whether or not the user can access the current context. |
||
92 | * |
||
93 | * @param Request $request |
||
94 | * @param string $permission |
||
95 | * |
||
96 | * @return bool |
||
97 | */ |
||
98 | 44 | protected function canAccess(Request $request, $permission) |
|
127 | |||
128 | /** |
||
129 | * Return the model object of the current context. |
||
130 | * We check the lowest ( Comment ) first, to the highest ( Project ). |
||
131 | * |
||
132 | * @param Route $route |
||
133 | * |
||
134 | * @return ModelAbstract|null |
||
135 | */ |
||
136 | 20 | protected function getCurrentContext(Route $route) |
|
147 | |||
148 | /** |
||
149 | * Returns the permission defined in route action. |
||
150 | * |
||
151 | * @param Request $request |
||
152 | * |
||
153 | * @return mixed |
||
154 | */ |
||
155 | 44 | protected function getPermission(Request $request) |
|
161 | } |
||
162 |
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: