Catch exceptions

This commit is contained in:
Sebastian Meyer 2023-09-29 19:28:08 +02:00
parent 00d6e24f31
commit 128e377712
2 changed files with 9 additions and 2 deletions

View File

@ -65,6 +65,11 @@ trait Getter
*/ */
final public function __isset(string $property): bool final public function __isset(string $property): bool
{ {
return !empty($this->__get($property)); try {
$value = $this->__get($property);
} catch (\InvalidArgumentException) {
$value = null;
}
return !empty($value);
} }
} }

View File

@ -68,6 +68,8 @@ trait Setter
*/ */
final public function __unset(string $property): void final public function __unset(string $property): void
{ {
$this->__set($property, null); try {
$this->__set($property, null);
} catch (\InvalidArgumentException) {}
} }
} }