-
Type:
Task
-
Resolution: Unresolved
-
Priority:
Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
There are numerous places in PHPC where we check for return values of functions that are always successful. This is mainly done for defensive reasons and to avoid any risks of future changes (e.g. introducing failure cases to a function down the line).
Two recent examples:
- https://github.com/mongodb/mongo-php-driver/pull/1409#discussion_r1208897177
- https://github.com/mongodb/mongo-php-driver/pull/1412#discussion_r1206321486
This practice may be inconsistent within PHPC. It would be prudent to settle on a single approach to enforce everywhere (e.g. always defensive, allow assumptions with a comment).
We could also benefit from (re-)integrating static analysis to identify unreachable code.