Skip to content

Commit

Permalink
make csfixer happy about null check
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthieu Rolland authored and Matthieu Rolland committed Feb 29, 2024
1 parent 19ae35d commit 09ec25e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion classes/Tools.php
Original file line number Diff line number Diff line change
Expand Up @@ -1770,7 +1770,9 @@ public static function ps_round($value, $precision = 0, $round_mode = null)
public static function math_round($value, $places, $mode = PS_ROUND_HALF_UP)
{
// since php 8.1 the round function won't tolerate null values
$value = $value ?? 0.0;
if ($value === null) {
$value = 0.0;
}

//If PHP_ROUND_HALF_UP exist (PHP 5.3) use it and pass correct mode value (PrestaShop define - 1)
if (defined('PHP_ROUND_HALF_UP')) {
Expand Down

0 comments on commit 09ec25e

Please sign in to comment.