webmozarts / assert

Assertions to validate method input/output with nice error messages.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MinCount and MaxCount assertion

JustBlackBird opened this issue · comments

I've faced a use case where I should check length of a \Countable. I see two methods for such checks:

  1. Assert::minCount is like Assert::minLength but for \Countable
  2. Assert::maxCount is like Assert::maxLength but for \Countable

Also an assertion that the passed in argument is a \Countable can be added.

The question is: are the maintainers interested in such methods inside of the library? Is so I could provide a PR with their implementation.

I don't see any argument against. All three assertions seem valid to me. :)

For sake of completeness, I'd add countBetween() too then.