Skip to content

Commit

Permalink
DeferredInArrayValidator: Don't cache callback result
Browse files Browse the repository at this point in the history
  • Loading branch information
nilmerg committed Dec 6, 2022
1 parent c7e9ae3 commit 4c9a4d1
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/DeferredInArrayValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,7 @@ public function __construct(callable $callback, array $options = [])

public function getHaystack(): array
{
if (! isset($this->haystack)) {
$this->haystack = call_user_func($this->callback);
}

return $this->haystack;
return $this->haystack ?? call_user_func($this->callback);
}

/**
Expand Down

0 comments on commit 4c9a4d1

Please sign in to comment.