Right now calling this triggers an error as the returned header is string|null, but really after ->has($key) returns true, we can assert that ->get($sameKey) will be string. At least as long as there is no other impure call made in between like ->remove() or ->replace()
if ($request->headers->has('foo')) {
$v = strtolower($request->headers->get('foo'));
}