Spanner/src/ValueMapper.php
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];
    }
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];
    }
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 ] ; }
Infer the type of a parameter and ensure that the definition, if given,
is valid.

Because types are provided as either an integer code, or a StructType
or an ArrayType, and `paramType()` accepts the type and Struct/Array
definition separately, this method determines the proper value of
both the type and definition prior to calling `paramType()`.

@param mixed $type The type code or definition.
@param string $key the parameter key name.
@return array Containing the type value at position 0, and definition or
null at position 1.
Infer the type of a parameter and ensure that the definition if given is valid .