Skip to content

Commit 6f5d344

Browse files
committed
Add any to Collections
1 parent 5dfe761 commit 6f5d344

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

en/core-libraries/collections.rst

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ List of Methods
5353
.. csv-table::
5454
:class: docutils internal-toc
5555

56-
:php:meth:`append`, :php:meth:`appendItem`, :php:meth:`avg`,
56+
:php:meth:`any`, :php:meth:`append`, :php:meth:`appendItem`, :php:meth:`avg`,
5757
:php:meth:`buffered`, :php:meth:`chunk`, :php:meth:`chunkWithKeys`
5858
:php:meth:`combine`, :php:meth:`compile`, :php:meth:`contains`
5959
:php:meth:`countBy`, :php:meth:`each`, :php:meth:`every`
@@ -361,16 +361,21 @@ a collection matches a test you can use ``every()``::
361361
return $person->age < 21;
362362
});
363363

364+
.. php:method:: any($callback)
364365
.. php:method:: some($callback)
365366
366367
You can see if the collection contains at least one element matching a filter
367-
function using the ``some()`` method::
368+
function using the ``any()`` method::
368369

369370
$collection = new Collection($people);
370-
$hasYoungPeople = $collection->some(function ($person) {
371+
$hasYoungPeople = $collection->any(function ($person) {
371372
return $person->age < 21;
372373
});
373374

375+
.. note::
376+
377+
The ``some()`` method is an alias of ``any()``.
378+
374379
.. php:method:: match($conditions)
375380
376381
If you need to extract a new collection containing only the elements that

0 commit comments

Comments
 (0)