- 实现 __isset 魔术方法以检查配置项是否存在 - 当配置值不为 null 时返回 true,否则返回 false
@@ -28,4 +28,9 @@ trait ConfigTrait
{
return $this->getConfig($name);
}
+
+ public function __isset(string $name): bool
+ {
+ return $this->getConfig($name) !== null;
+ }