private static function myValidateDomainParts(array $domainParts, ?string &$error): bool
    {
        foreach ($domainParts as $part) {
            if (!is_string($part)) {
                throw new \InvalidArgumentException('$domainParts parameter is not an array of strings.');
            }

            if (!self::myValidateDomainPart($part, $error)) {
                return false;
            }
        }

        return true;
    }