protected function getUser()
    {
        trigger_error('DrupalSubContextBase::getUser() is deprecated. Use RawDrupalContext::getUserManager()->getCurrentUser() instead.', E_USER_DEPRECATED);

        $user = $this->getUserManager()->getCurrentUser();

        if (empty($user)) {
            throw new \Exception('No user is logged in.');
        }

        return $user;
    }