Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve type hints in UniqueGenerator #345

Merged
merged 4 commits into from
Jul 14, 2021
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
23 changes: 21 additions & 2 deletions src/Faker/UniqueGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,34 @@
namespace Faker;

/**
* Proxy for other generators, to return only unique values. Works with
* Faker\Generator\Base->unique()
* Proxy for other generators that returns only unique values.
*
* Instantiated through @see Generator::unique().
*
* @mixin Generator
*/
class UniqueGenerator
{
/**
* @var Generator
*/
protected $generator;

/**
* @var int
*/
protected $maxRetries;

/**
* Maps from method names to a map with serialized result keys.
*
* @example [
* 'phone' => ['0123' => null],
* 'city' => ['London' => null, 'Tokyo' => null],
* ]
*
* @var array<string, array<string, null>>
spawnia marked this conversation as resolved.
Show resolved Hide resolved
*/
protected $uniques = [];

/**
Expand Down