It seems like $contentType can also be of type null; however, parameter $haystack of str_contains() does only seem to accept string, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the ignore-type annotation
25
if (str_contains(/** @scrutinizer ignore-type */ $contentType, 'json')) {
Loading history...
26
return new JsonResponse($session);
27
}
28
29
if (str_contains($contentType, 'html')) {
30
return new HtmlResponse($session);
31
}
32
33
throw new \RuntimeException("Unable to create browser response for \"{$contentType}\".");