Switch to cast to coerce values into floats.

This commit is contained in:
barryhughes 2022-05-18 20:43:38 +00:00
parent dc98056178
commit a1279e67c6
1 changed files with 2 additions and 2 deletions

View File

@ -1884,9 +1884,9 @@ function wc_get_rounding_precision() {
* @param bool $round If should round after adding precision.
* @return int|float
*/
function wc_add_number_precision( $value, $round = true ) {
function wc_add_number_precision( float $value, bool $round = true ) {
$cent_precision = pow( 10, wc_get_price_decimals() );
$value = '' === $value ? 0.0 : $value * $cent_precision;
$value = $value * $cent_precision;
return $round ? NumberUtil::round( $value, wc_get_rounding_precision() - wc_get_price_decimals() ) : $value;
}