'Work out the constant name and type is, returns these as tuple'

def _getConstantNameAndType(self, styles, text, p):

    constant_name = ''
    constant_type = None
    if ((styles[p] == self.PHP_OPERATOR) and (text[p] == '(')):
        p += 1
    while (p < len(styles)):
        if (styles[p] in self.PHP_STRINGS):
            constant_name += self._unquoteString(text[p])
        elif ((styles[p] == self.PHP_WORD) and (text[p] == '__NAMESPACE__') and self.currentNamespace):
            constant_name += self.currentNamespace.name
        elif (text[p] == ','):
            (constant_type, p) = self._getVariableType(styles, text, (p + 1), assignmentChar=None)
            break
        p += 1
    return (self._unescape_string(constant_name), constant_type)
