Skip to content

Commit

Permalink
Fix uninitialized Base::unique
Browse files Browse the repository at this point in the history
  • Loading branch information
simPod committed Apr 11, 2021
1 parent 91a6806 commit a81eb04
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
5 changes: 0 additions & 5 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -760,11 +760,6 @@ parameters:
count: 1
path: src/Faker/Provider/Base.php

-
message: "#^Negated boolean expression is always false\\.$#"
count: 1
path: src/Faker/Provider/Base.php

-
message: "#^Parameter \\$validator of method Faker\\\\Provider\\\\Base\\:\\:valid\\(\\) has invalid typehint type Faker\\\\Provider\\\\Closure\\.$#"
count: 1
Expand Down
6 changes: 3 additions & 3 deletions src/Faker/Provider/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ class Base
protected $generator;

/**
* @var \Faker\UniqueGenerator
* @var \Faker\UniqueGenerator|null
*/
protected $unique;
protected $unique = null;

public function __construct(Generator $generator)
{
Expand Down Expand Up @@ -621,7 +621,7 @@ public function optional($weight = 0.5, $default = null)
*/
public function unique($reset = false, $maxRetries = 10000)
{
if ($reset || !$this->unique) {
if ($reset || $this->unique === null) {
$this->unique = new UniqueGenerator($this->generator, $maxRetries);
}

Expand Down

0 comments on commit a81eb04

Please sign in to comment.