You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since #94, this extension supports the scenario of checking a Collections's emptiness and then using first() and last() on that collection without worrying about the return type being false. This is great, however, a Collection being empty has more effects than this, including:
toArray() returning a non-empty-array
getKeys() returning a non-empty-list
getValues() returning a non-empty-list
code in loops iterating over a non-empty array will be executed at least once
Also, a Collection being empty could be asserted by
checking count() returns a value other than 0
calling add() at least once
calling set() at least once
calling a custom method that was annotated with @psalm-assert !$collection->isEmpty() with the collection
checking contains() returns true
checking current() doesn't return false
checking key() doesn't return null
checking next() doesn't return false
the Collection being created using the map() method of another non-empty Collection
checking indexOf() doesn't return false
The text was updated successfully, but these errors were encountered:
janopae
changed the title
Support more consequences consequences of non-empty collections
Support more consequences of non-empty collections
Mar 2, 2022
Since #94, this extension supports the scenario of checking a Collections's emptiness and then using
first()
andlast()
on that collection without worrying about the return type beingfalse
. This is great, however, a Collection being empty has more effects than this, including:toArray()
returning anon-empty-array
getKeys()
returning anon-empty-list
getValues()
returning anon-empty-list
Also, a Collection being empty could be asserted by
count()
returns a value other than 0add()
at least onceset()
at least once@psalm-assert !$collection->isEmpty()
with the collectioncontains()
returns truecurrent()
doesn't return falsekey()
doesn't return nullnext()
doesn't return falsemap()
method of another non-empty CollectionindexOf()
doesn't return falseThe text was updated successfully, but these errors were encountered: