Skip to content

Commit

Permalink
fix php 8.1 float to int deprecation warning (#136)
Browse files Browse the repository at this point in the history
Co-authored-by: Oliver Laptop <[email protected]>
  • Loading branch information
olivermbs and Oliver Laptop authored Jul 4, 2022
1 parent 539913b commit a51e8b1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/Legacy/Numbers/Words/Locale/It.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class It extends Words
'sei',
'sette',
'otto',
'nove'
'nove',
];

private $wordSeparator = '';
Expand Down Expand Up @@ -83,8 +83,8 @@ protected function toWords($number, $power = 0)
$ret .= $this->toWords($thousands, 3) . $this->wordSeparator;
}

$hundreds = (int) ($number / 100 % 10);
$tens = (int) ($number / 10 % 10);
$hundreds = (int) ($number % 1000 / 100);
$tens = (int) ($number % 100 / 10);
$units = (int) ($number % 10);

// centinaia: duecento, trecento, etc...
Expand Down
6 changes: 2 additions & 4 deletions src/Legacy/Numbers/Words/Locale/Ka.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class Ka extends Words
const FRACTION_PREFIX = ' მე';
const FRACTION_SUFFIX = 'ედი';


private static $dictionary = [
0 => 'ნულ',
1 => 'ერთ',
Expand Down Expand Up @@ -68,7 +67,7 @@ class Ka extends Words
'TRY' => [['ლირა'], ['ყურუში']],
'AMD' => [['დრამი'], ['ლუმა']],
'PLN' => [['ზლოტი'], ['გროში']],
'GBP' => [['ფუნტი'], ['პენი']]
'GBP' => [['ფუნტი'], ['პენი']],
];

public function toCurrencyWords($currency, $decimal, $fraction = null)
Expand Down Expand Up @@ -139,7 +138,7 @@ protected function toWords($number, $use_suffix = true, $use_spaces = true)
}
break;
case $number < 1000:
$hundreds = $number / 100;
$hundreds = (int) ($number % 1000 / 100);
$remainder = $number % 100;
$hundredsStr = $hundreds < 2 ? '' : self::$dictionary[$hundreds];
$string = $hundredsStr . self::$dictionary[100];
Expand Down Expand Up @@ -177,5 +176,4 @@ protected function toWords($number, $use_suffix = true, $use_spaces = true)
return $string;
}


}

0 comments on commit a51e8b1

Please sign in to comment.