1 | <?php |
||
9 | class CookieConsentMiddleware |
||
10 | { |
||
11 | /** @var \Illuminate\Contracts\Foundation\Application */ |
||
12 | protected $app; |
||
13 | |||
14 | public function __construct(Application $app) |
||
18 | |||
19 | /** |
||
20 | * @param \Illuminate\Http\Request $request |
||
21 | * @param \Closure $next |
||
22 | * |
||
23 | * @return mixed |
||
24 | * |
||
25 | * @throws \Symfony\Component\HttpKernel\Exception\HttpException |
||
26 | */ |
||
27 | public function handle($request, Closure $next) |
||
41 | |||
42 | protected function containsBodyTag(Response $response): bool |
||
46 | |||
47 | protected function addCookieConsentScriptToResponse(Response $response): Response |
||
60 | |||
61 | |||
62 | /** |
||
63 | * @param string $content |
||
64 | * |
||
65 | * @return int|bool |
||
66 | */ |
||
67 | protected function getLastClosingBodyTagPosition(string $content = '') |
||
71 | } |
||
72 |
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: