The php_phongo_bson_typemap struct currently contains two members for each type map path:
typedef struct {
php_phongo_bson_typemap_types document_type;
zend_class_entry* document;
php_phongo_bson_typemap_types array_type;
zend_class_entry* array;
php_phongo_bson_typemap_types root_type;
zend_class_entry* root;
// ...
}
This can be refactored to declare a new struct consisting of type and class members that are used instead of the current double entry. This future-proofs the type map struct for changes (one prototype for ODM deserialisation features adds a zval* to the type map) and allows better reusability of logic working with a type map element.