spl - It is okay to implement \Countable in a PHP class that is not meant to be iterable? -


i have multipleexception class collects exceptions (e.g. multiple errors in form fields) , implements countable, don't want iterable list, cause exception (you never throw list).

is okay in terms of software design? or misusing spl countable interface?

which right way?

thanks

it okay.

countable there of classes can customise value returned calling count() instance. completely separate class being iterable.


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -