'Set assignmentChar to None to skip over looking for this char first'

def _getVariableType(self, styles, text, p, assignmentChar='='):

    log.debug('_getVariableType:    text:    %r', text[p:])
    typeNames = []
    if (((p + 1) < len(styles)) and ((assignmentChar is None) or ((styles[p] == self.PHP_OPERATOR) and (text[p] == assignmentChar)))):
        if (assignmentChar is not None):
            p += 1
            if ((p + 1) >= len(styles)):
                return (typeNames, p)
        if ((styles[p] == self.PHP_OPERATOR) and (text[p] == '&')):
            log.debug("_getVariableType:    skipping    over    reference    char    '&'")
            p += 1
            if ((p + 1) >= len(styles)):
                return (typeNames, p)
        elif (((p + 3) <= len(styles)) and (styles[p] == self.PHP_OPERATOR) and (text[(p + 2)] == ')') and (text[(p + 1)] in self._citdl_type_from_cast)):
            typeNames = [self._citdl_type_from_cast.get(text[(p + 1)])]
            log.debug('_getVariableType:    casted    to    type:    %r', typeNames)
            p += 3
            return (typeNames, p)
        if (styles[p] == self.PHP_WORD):
            keyword = text[p].lower()
            p += 1
            if (keyword == 'new'):
                (typeNames, p) = self._getIdentifiersFromPos(styles, text, p)
            elif (keyword in ('true', 'false')):
                typeNames = ['boolean']
            elif (keyword == 'array'):
                typeNames = ['array()']
            elif (keyword == 'clone'):
                (typeNames, p) = self._getIdentifiersFromPos(styles, text, p, identifierStyle=self.PHP_VARIABLE)
        elif (styles[p] in self.PHP_STRINGS):
            p += 1
            typeNames = ['string']
        elif (styles[p] == self.PHP_NUMBER):
            p += 1
            typeNames = ['int']
        elif (styles[p] == self.PHP_IDENTIFIER):
            if (text[p].lower() in ('true', 'false')):
                p += 1
                typeNames = ['boolean']
            else:
                (typeNames, p) = self._getIdentifiersFromPos(styles, text, p)
                if (typeNames == ['NULL']):
                    typeNames = []
                elif (typeNames and (p < len(styles)) and (styles[p] == self.PHP_OPERATOR) and (text[p][0] == '(')):
                    typeNames[(-1)] += '()'
        elif (styles[p] == self.PHP_VARIABLE):
            (typeNames, p) = self._getIdentifiersFromPos(styles, text, p, self.PHP_VARIABLE)
        elif ((styles[p] == self.PHP_OPERATOR) and (text[p] == '\\')):
            (typeNames, p) = self._getIdentifiersFromPos(styles, text, p, self.PHP_IDENTIFIER)
    return (typeNames, p)
