Assert unique values in array
Isinlor opened this issue · comments
Tomasz Darmetko commented
One more proposition - allow to assert that all values in an array are unique e.g.
Assert::uniqueValues($array)
Assert::allUnique($array)
Assert::noDuplicates($array)
I would follow semantics of array_unique()
so probably the assertion would look like:
count($array) === count(array_unique($array))
Jules Pietri commented
👍 on Assert::uniqueValues(iterable $iterable)
David Garcia commented
https://secure.php.net/manual/en/language.types.iterable.php
Iterable is a pseudo-type introduced in PHP 7.1
Given this repo needs to keep compatibility with previous PHP versions, then we can't use iterable
but array