validateArray($value); } return in_array(gettype($value), self::PRIMITIVES); } private function validateArray(array $value): bool { if ($value === []) { return true; } $type = gettype(reset($value)); if (!in_array($type, self::PRIMITIVES)) { return false; } foreach ($value as $v) { if (in_array(gettype($v), self::NUMERICS) && in_array($type, self::NUMERICS)) { continue; } if (gettype($v) !== $type) { return false; } } return true; } public function getInvalidMessage(): string { return 'attribute with non-primitive or non-homogeneous array of primitives dropped'; } }