Skip to content

Commit fd6caab

Browse files
committed
show array example
1 parent e103922 commit fd6caab

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

collections.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -788,10 +788,12 @@ You may stop iterating through the items by returning `false` from the callback:
788788
<a name="method-ensure"></a>
789789
#### `ensure()` {.collection-method}
790790

791-
The `ensure` method may be used to verify that all elements of a collection are of a given type. Otherwise, an `UnexpectedValueException` will be thrown:
791+
The `ensure` method may be used to verify that all elements of a collection are of a given type or list of types. Otherwise, an `UnexpectedValueException` will be thrown:
792792

793793
return $collection->ensure(User::class);
794794

795+
return $collection->ensure([User::class, Customer::class]);
796+
795797
Primitive types such as `string`, `int`, `float`, `bool`, and `array` may also be specified:
796798

797799
return $collection->ensure('int');

0 commit comments

Comments
 (0)