diff --git a/src/MultiLanguageWrapper/ClassValidator.php b/src/MultiLanguageWrapper/ClassValidator.php index 485d9c3..5e649fd 100644 --- a/src/MultiLanguageWrapper/ClassValidator.php +++ b/src/MultiLanguageWrapper/ClassValidator.php @@ -85,7 +85,8 @@ public function merge(string $returnTypeClass, $existingInstance, $newInstance) if (array_key_exists($returnTypeClass, $this->getRequiredFields()) && $newInstance !== null) { foreach ($this->getRequiredFields()[$returnTypeClass] as $property) { if (is_array($existingInstance)) { - for ($index = 0; $index < sizeof($existingInstance); $index++) { + $existingInstanceSize = sizeof($existingInstance); + for ($index = 0; $index < $existingInstanceSize; $index++) { if ($existingInstance[$index]->{$property} === null) { $existingInstance[$index]->{$property} = $newInstance[$index]->{$property}; }