mirror of
https://github.com/opencultureconsulting/php-basics.git
synced 2025-03-09 00:00:38 +01:00
Catch exceptions
This commit is contained in:
parent
00d6e24f31
commit
128e377712
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -68,6 +68,8 @@ trait Setter
|
||||
*/
|
||||
final public function __unset(string $property): void
|
||||
{
|
||||
$this->__set($property, null);
|
||||
try {
|
||||
$this->__set($property, null);
|
||||
} catch (\InvalidArgumentException) {}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user