对 if 语句的疑惑
今天整理项目代码,看到如下代码:
if ($userInfo) {
return new static($userInfo);
}
return null;
请问和下面代码哪个更好些?
if ($userInfo) {
return new static($userInfo);
} else {
return null;
}