Skip to content

Commit e911430

Browse files
authored
accept null in numberFormat (x-tools#604)
1 parent 6d1bfe1 commit e911430

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Helper/I18nHelper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,11 @@ public function msgIfExists( ?string $message, array $vars = [] ): string {
189189

190190
/**
191191
* Format a number based on language settings.
192-
* @param int|float $number
192+
* @param int|float|null $number
193193
* @param int $decimals Number of decimals to format to.
194194
* @return string
195195
*/
196-
public function numberFormat( int|float $number, int $decimals = 0 ): string {
196+
public function numberFormat( int|float|null $number, int $decimals = 0 ): string {
197197
$lang = $this->getLangForTranslatingNumerals();
198198
if ( !isset( $this->numFormatter ) ) {
199199
$this->numFormatter = new NumberFormatter( $lang, NumberFormatter::DECIMAL );

src/Twig/AppExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,11 +446,11 @@ public function getFilters(): array {
446446

447447
/**
448448
* Format a number based on language settings.
449-
* @param int|float $number
449+
* @param int|float|null $number
450450
* @param int $decimals Number of decimals to format to.
451451
* @return string
452452
*/
453-
public function numberFormat( int|float $number, int $decimals = 0 ): string {
453+
public function numberFormat( int|float|null $number, int $decimals = 0 ): string {
454454
return $this->i18n->numberFormat( $number, $decimals );
455455
}
456456

0 commit comments

Comments
 (0)