我想做,但可以回来。self::container()->get($path);self::container()null
有没有一种更快的方法来避免在链接函数调用时出错,并且有些方法可以返回null而不是对象?Call to a member function get() on null
有没有比嘲笑预期对象/成员的丑陋解决方法更好的方法?
public static function getDependency($path) {
return self::container() ??
(new class{public function get($path){return null;}})->get($path);
}
我所追求的是类似于C中的空条件成员访问运算符()#?.
浮云间
30秒到达战场