Skip to content

Commit

Permalink
suppress psalm's ImpureFunctionCall in Maybe::withLazyDefault()
Browse files Browse the repository at this point in the history
  • Loading branch information
someniatko authored and marcosh committed Jul 5, 2022
1 parent 457b641 commit 5b4cddb
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Maybe.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ public function withLazyDefault(callable $a)
// This can be implemented in terms of eval(), however the actual implementation is optimized:
// return $this->eval($ifNothing, fn($value) => fn() => $ifJust($value))();

/**
* @psalm-suppress ImpureFunctionCall
*/
return $this->isJust
? $this->value
: $a();
Expand Down

0 comments on commit 5b4cddb

Please sign in to comment.