protected function getVarType($var, $arrayLevel = 0)
    {
        $phpType = gettype($var);
        switch ($phpType) {
            case 'boolean':
                $result = 'bool';
                break;
            case 'integer':
                $result = 'int';
                break;
            case 'double':
                $result = 'float';
                break;
            case 'string':
                $result = 'string';
                break;
            case 'array':
                if ($arrayLevel > 1) {
                    $result = 'array';
                } else {
                    $result = null;
                    $first = true;
                    foreach ($var as $item) {
                        $itemType = $this->getVarType($item, $arrayLevel + 1);
                        if ($first) {
                            $result = $itemType;
                            $commonObjectDescriptors = $this->getObjectDescriptors($item);
                            $first = false;
                        } else {
                            if ($result !== $itemType) {
                                $result = null;
                                if (empty($commonObjectDescriptors)) {
                                    break;
                                }
                                if (!empty($commonObjectDescriptors)) {
                                    $commonObjectDescriptors = array_intersect($commonObjectDescriptors, $this->getObjectDescriptors($item));
                                }
                            }
                        }
                    }
                    if ($result !== null) {
                        $result .= '[]';
                    } elseif (!empty($commonObjectDescriptors)) {
                        $result = array_shift($commonObjectDescriptors) . '[]';
                    } else {
                        $result = 'array';
                    }
                }
                break;
            case 'object':
                $result = get_class($var);
                if ($result === false) {
                    $result = 'mixed';
                } else {
                    if ($this->insideNamespace) {
                        $result = '\\' . $result;
                    }
                }
                break;
            case 'resource':
                $result = 'resource';
                break;
            case 'NULL':
                $result = 'null';
                break;
            case 'unknown type':
            default:
                $result = 'mixed';
                break;
        }

        return $result;
    }