webmozarts / assert

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Assert::notOneOf

adrienbrault opened this issue · comments

Hi,

I would like a way to assert that something is NOT in an array. I found how to check that something is in an array, but not the opposite.
Maybe add notOneOf ? Or some sort of magic method that would allow to negate any assertion ?

Hey.

That is a nice feature. But the more I think of it, I cant come up with a good use case.
Whenever I use an assertion I do it because I want to be sure what data Im dealing with. Ie, Im "whitelisting" data. notOneOf would blacklist data.

Can you give me a scenario when notOneOf* is needed?

I second @Nyholm's thoughts. I never had this use case - when is the negation useful?

Im closing this due inactivity. Feel free to reopen this issue again if you want.

I just ran into this problem that notOneOf() does not exist. I'm working on an internal database tool and we have a blacklist of tables due to some specific implementation details.

Another use cases I can think of are reserved keywords or names.