Allow to count "null" and "false" values
Legacy codebases can have methods with dual return value:
- an array when data is found
- null when no data is found
Then count is called, to ensure there are data.
In modern PHP, this triggers a warning;
count(): Parameter must be an array or an object that implements Countable
This change provides a method to accept also null and false values.
In such case, the 0 value is returned.
This method isn't intended to be totally permissive: if something
else than an array, a Countable, null or false is passed
as parameter, a TypeError error is thrown, even with falsy values.
Test Plan: Tests provided with countable and not countable variables.
Reviewed By: dereckson
Differential Revision: https://devcentral.nasqueron.org/D1632