Skip to content

Commit

Permalink
\LastDragon_ru\LaraASP\Formatter\Formatter::currency() will accept …
Browse files Browse the repository at this point in the history
…`$currency`.
  • Loading branch information
LastDragon-ru committed Nov 15, 2024
1 parent 6eeff33 commit bae8740
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/formatter/src/Formatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,11 @@ public function decimal(float|int|null $value): string {
return $this->format(self::Decimal, $value);
}

public function currency(float|int|null $value): string {
return $this->format(self::Currency, $value);
/**
* @param non-empty-string|null $currency
*/
public function currency(float|int|null $value, ?string $currency = null): string {
return $this->format(self::Currency, [$value, $currency]);
}

/**
Expand Down
1 change: 1 addition & 0 deletions packages/formatter/src/FormatterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ public function testCurrency(): void {
$formatter = $this->formatter->forLocale('en_US');

self::assertEquals('$10.00', $formatter->currency(10));
self::assertEquals('€10.00', $formatter->currency(10, 'EUR'));
self::assertEquals('$10.03', $formatter->currency(10.0324234));
}

Expand Down

0 comments on commit bae8740

Please sign in to comment.