1 | <?php |
||
15 | class TraceUser |
||
16 | { |
||
17 | /** |
||
18 | * Rate Limiter |
||
19 | * |
||
20 | * @var \Illuminate\Cache\RateLimiter |
||
21 | */ |
||
22 | private $limiter; |
||
23 | |||
24 | /** |
||
25 | * Sets the Rate Limiter. |
||
26 | * |
||
27 | * @param \Illuminate\Cache\RateLimiter $limiter |
||
28 | */ |
||
29 | public function __construct(RateLimiter $limiter) |
||
33 | |||
34 | /** |
||
35 | * Handle an incoming request and trace the user |
||
36 | * if the current user is authenticated. |
||
37 | * |
||
38 | * @param \Illuminate\Http\Request $request |
||
39 | * @param \Closure $next |
||
40 | * @return mixed |
||
41 | */ |
||
42 | public function handle($request, Closure $next) |
||
58 | |||
59 | /** |
||
60 | * Stores the user request in the database. |
||
61 | * |
||
62 | * @param \Illuminate\Contracts\Auth\Authenticatable $user |
||
63 | * @param \Illuminate\Http\Request $request |
||
64 | * @param \Symfony\Component\HttpFoundation\Response $response |
||
65 | * |
||
66 | * @return \Protonemedia\LaravelTracer\UserRequest|null |
||
67 | */ |
||
68 | private function traceUserRequest(UserContract $user, Request $request, Response $response): ? UserRequest |
||
85 | |||
86 | /** |
||
87 | * Returns the qualified name for the given request and route data. |
||
88 | * |
||
89 | * @param \Illuminate\Http\Request $request |
||
90 | * @param \Illuminate\Routing\Route $route |
||
91 | * @return mixed |
||
92 | */ |
||
93 | private function qualify(Request $request, Route $route) : array |
||
108 | |||
109 | /** |
||
110 | * Returns a boolean wether this request has been attemped to |
||
111 | * trace too many times. |
||
112 | * |
||
113 | * @param array $qualified |
||
114 | * @return boolean |
||
115 | */ |
||
116 | private function tooManyAttempts(array $qualified): bool |
||
134 | |||
135 | private function shouldTraceUser(Request $request, Response $response): bool |
||
143 | } |
||
144 |
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: