-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
As noted in this comment thread for PHPC-1411, php_phongo_write_concern_to_zval is only used when generating debug info for a BulkWrite object.
I believe we can remove this function entirely by modifying php_phongo_bulkwrite_get_debug_info to delete php_phongo_write_concern_to_zval in favor of calling phongo_writeconcern_init. The only side effect that I noticed from doing so is that the debug output of BulkWrite may now include a WriteConcern object instead of a flat array. I don't recall the original motivation for creating php_phongo_write_concern_to_zval, but I don't see an issue with the debug output having objects within it as that's what one might expect for userland PHP classes.
Note that a BulkWrite will only have a WriteConcern after it has been executed, so we have very little test coverage for this function. Most var_dump() expectations for BulkWrite objects are pre-execution and expect a NULL write concern. AFAIK, only write-0002.php provides code coverage, and even then only for a single write concern.