Skip to content

Commit

Permalink
Fix UniqueGenerator not storing previously generated values when call…
Browse files Browse the repository at this point in the history
…ing ->ext() method
  • Loading branch information
Bram Ceulemans committed Jan 18, 2022
1 parent 598bec1 commit 88bb072
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Faker/UniqueGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,20 @@ class UniqueGenerator
protected $uniques = [];

/**
* @param Extension|Generator $generator
* @param int $maxRetries
* @param Extension|Generator $generator
* @param int $maxRetries
* @param array<string, array<string, null>> $uniques
*/
public function __construct($generator, $maxRetries = 10000)
public function __construct($generator, $maxRetries = 10000, & $uniques = [])
{
$this->generator = $generator;
$this->maxRetries = $maxRetries;
$this->uniques = &$uniques;
}

public function ext(string $id)
{
return new self($this->generator->ext($id), $this->maxRetries);
return new self($this->generator->ext($id), $this->maxRetries, $this->uniques);
}

/**
Expand Down

0 comments on commit 88bb072

Please sign in to comment.