diff --git a/src/Traits/Getter.php b/src/Traits/Getter.php index cd2ce95..41f65a6 100644 --- a/src/Traits/Getter.php +++ b/src/Traits/Getter.php @@ -65,6 +65,11 @@ trait Getter */ final public function __isset(string $property): bool { - return !empty($this->__get($property)); + try { + $value = $this->__get($property); + } catch (\InvalidArgumentException) { + $value = null; + } + return !empty($value); } } diff --git a/src/Traits/Setter.php b/src/Traits/Setter.php index 568a639..6aa3e85 100644 --- a/src/Traits/Setter.php +++ b/src/Traits/Setter.php @@ -68,6 +68,8 @@ trait Setter */ final public function __unset(string $property): void { - $this->__set($property, null); + try { + $this->__set($property, null); + } catch (\InvalidArgumentException) {} } }