1 | <?php |
||
8 | class CookieConsentMiddleware |
||
9 | { |
||
10 | public function handle($request, Closure $next) |
||
32 | |||
33 | /** |
||
34 | * Excluded routes. |
||
35 | * |
||
36 | * @param $request |
||
37 | * @return bool |
||
38 | */ |
||
39 | protected function excluded($request): bool |
||
40 | { |
||
41 | return in_array($request->route()->getName(), config('cookie-consent.excluded' ?: [])); |
||
42 | } |
||
43 | |||
44 | protected function containsBodyTag(Response $response): bool |
||
48 | |||
49 | /** |
||
50 | * @param \Illuminate\Http\Response $response |
||
51 | * |
||
52 | * @return $this |
||
53 | */ |
||
54 | protected function addCookieConsentScriptToResponse(Response $response) |
||
67 | |||
68 | protected function getLastClosingBodyTagPosition(string $content = '') |
||
72 | } |
||
73 |
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: