📅  最后修改于: 2022-03-11 14:54:50.142000             🧑  作者: Mango
BEFORE
$country = null;
if ($session !== null) {
$user = $session->user;
if ($user !== null) {
$address = $user->getAddress();
if ($address !== null) {
$country = $address->country;
}
}
}
AFTER
$country = $session?->user?->getAddress()?->country;