private function resolveTypeDefinition($type, $key = null)
    {
        $definition = null;
        if (is_array($type)) {
            $type += [
                1 => null,
                2 => null
            ];

            $definition = new ArrayType($type[1], $type[2]);
            $type = Database::TYPE_ARRAY;
        } elseif ($type instanceof ArrayType) {
            $definition = $type;
            $type = Database::TYPE_ARRAY;
        } elseif ($type instanceof StructType) {
            $definition = $type;
            $type = Database::TYPE_STRUCT;
        }

        return [$type, $definition];
    }