token_entity_info_alter() always ensures a 'token type' is set in entity info:
if (!empty($info[$entity_type]['token type'])) {
// If the entity's token type is already defined, great!
continue;
}
// Fill in default token types for entities.
switch ($entity_type) {
case 'taxonomy_term':
case 'taxonomy_vocabulary':
// Stupid taxonomy token types...
$info[$entity_type]['token type'] = str_replace('taxonomy_', '', $entity_type);
break;
default:
// By default the token type is the same as the entity type.
$info[$entity_type]['token type'] = $entity_type;
break;
}
}
Therefore, presumably, this check in token_get_entity_mapping() is redundant:
$mapping[$entity_type] = !empty($info['token type']) ? $info['token type'] : $entity_type;