Skip to content

Commit 8f2dcaf

Browse files
authored
Improve type hints in UniqueGenerator (#345)
* Improve type hints in UniqueGenerator This accomplishes: - Clarifies the intent of the code - Aids autocompletion - Aids static analysis tools * Revert addition of strong type hint * Explain uniques
1 parent 22dfa01 commit 8f2dcaf

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

src/Faker/UniqueGenerator.php

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,34 @@
33
namespace Faker;
44

55
/**
6-
* Proxy for other generators, to return only unique values. Works with
7-
* Faker\Generator\Base->unique()
6+
* Proxy for other generators that returns only unique values.
7+
*
8+
* Instantiated through @see Generator::unique().
89
*
910
* @mixin Generator
1011
*/
1112
class UniqueGenerator
1213
{
14+
/**
15+
* @var Generator
16+
*/
1317
protected $generator;
18+
19+
/**
20+
* @var int
21+
*/
1422
protected $maxRetries;
23+
24+
/**
25+
* Maps from method names to a map with serialized result keys.
26+
*
27+
* @example [
28+
* 'phone' => ['0123' => null],
29+
* 'city' => ['London' => null, 'Tokyo' => null],
30+
* ]
31+
*
32+
* @var array<string, array<string, null>>
33+
*/
1534
protected $uniques = [];
1635

1736
/**

0 commit comments

Comments
 (0)