From 4b59c57496d7977bafdc03c32589a071693c9214 Mon Sep 17 00:00:00 2001 From: Sebastian Meyer Date: Sat, 7 Sep 2024 21:30:29 +0200 Subject: [PATCH] Access properties in class directly --- src/Traits/OverloadingGetter.php | 2 +- src/Traits/TypeChecker.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Traits/OverloadingGetter.php b/src/Traits/OverloadingGetter.php index 633df97..8a635c9 100644 --- a/src/Traits/OverloadingGetter.php +++ b/src/Traits/OverloadingGetter.php @@ -68,7 +68,7 @@ trait OverloadingGetter */ public function __isset(string $property): bool { - $value = $this->__get($property); + $value = $this->_data[$property] ?? null; return boolval($value) !== false; } } diff --git a/src/Traits/TypeChecker.php b/src/Traits/TypeChecker.php index 9a2042a..8fb8d55 100644 --- a/src/Traits/TypeChecker.php +++ b/src/Traits/TypeChecker.php @@ -96,10 +96,10 @@ trait TypeChecker */ public function hasAllowedType(mixed $value): bool { - if (count($this->getAllowedTypes()) === 0) { + if (count($this->_allowedTypes) === 0) { return true; } - foreach ($this->getAllowedTypes() as $type) { + foreach ($this->_allowedTypes as $type) { $function = 'is_' . $type; if (function_exists($function) && $function($value)) { return true; @@ -124,7 +124,7 @@ trait TypeChecker */ public function isAllowedType(string $type): bool { - return in_array($type, $this->getAllowedTypes(), true); + return in_array($type, $this->_allowedTypes, true); } /**