Skip to content
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.

[Docs] randomElement accepts an array #1993

Merged
merged 1 commit into from
Oct 23, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ print_r($values); // [0, 4, 8, 4, 2, 6, 0, 8, 8, 6]
// just like unique(), valid() throws an overflow exception when it can't generate a valid value
$values = array();
try {
$faker->valid($evenValidator)->randomElement(1, 3, 5, 7, 9);
$faker->valid($evenValidator)->randomElement([1, 3, 5, 7, 9]);
} catch (\OverflowException $e) {
echo "Can't pick an even number in that set!";
}
Expand Down