diff --git a/system/Entity/Entity.php b/system/Entity/Entity.php index 34876c5d7028..a92314faed71 100644 --- a/system/Entity/Entity.php +++ b/system/Entity/Entity.php @@ -287,7 +287,7 @@ private function hasChangedAttributes(?string $key = null): bool { // If no parameter was given then check all attributes if ($key === null) { - foreach ($this->attributes as $key => $value) { + foreach (array_keys($this->attributes) as $key) { if ($this->isChanged($key)) { return true; } @@ -574,13 +574,11 @@ public function __get(string $key) */ private function _getCastData(string $key, array $data) { - $result = null; - if (array_key_exists($key, $data)) { - $result = $this->castAs($data[$key], $key); + return $this->castAs($data[$key], $key); } - return $result; + return null; } /**