Skip to content

Commit

Permalink
Once Remember Null Values (#53949)
Browse files Browse the repository at this point in the history
  • Loading branch information
dbpolito authored Dec 17, 2024
1 parent 077b21e commit fba1ff5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Once.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ public function value(Onceable $onceable)

$hash = $onceable->hash;

if (isset($this->values[$object][$hash])) {
return $this->values[$object][$hash];
}

if (! isset($this->values[$object])) {
$this->values[$object] = [];
}

if (array_key_exists($hash, $this->values[$object])) {
return $this->values[$object][$hash];
}

return $this->values[$object][$hash] = call_user_func($onceable->callable);
}

Expand Down

0 comments on commit fba1ff5

Please sign in to comment.