Checking for null at every step:


$country =  null;
 
if ($session !== null) {
    $user = $session->user;
 
    if ($user !== null) {
        $address = $user->getAddress();
 
        if ($address !== null) {
            $country = $address->country;
        }
    }
}

With null-safe operator ?->:


$country = $session?->user?->getAddress()?->country;