Skip to content

Commit

Permalink
Added asAnyNumber as method to NumberCast
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrii Savluk committed Aug 14, 2024
1 parent 42866e1 commit d581d68
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/Support/Mapping/Casts/ConstNumberCast.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,20 @@

class ConstNumberCast extends ConstCast
{
protected bool $asAnyNumber = false;

public function __construct(
protected readonly int|float $value,
protected readonly bool $asAnyNumber
bool $asAnyNumber
) {
$this->asAnyNumber = $asAnyNumber;
}

public function asAnyNumber(): static
{
$this->asAnyNumber = true;

return $this;
}

public function originalValue(): int|float
Expand Down

0 comments on commit d581d68

Please sign in to comment.