The deprecated null value for the method round has been changed to zero.

This commit is contained in:
v.arsentev
2022-01-11 16:37:06 +03:00
committed by Fabien Potencier
parent 4c225d504f
commit 7d0e5d6a1e
2 changed files with 6 additions and 2 deletions
+2 -2
View File
@@ -581,6 +581,8 @@ function twig_replace_filter($str, $from)
*/
function twig_round($value, $precision = 0, $method = 'common')
{
$value = (float) $value;
if ('common' === $method) {
return round($value, $precision);
}
@@ -589,8 +591,6 @@ function twig_round($value, $precision = 0, $method = 'common')
throw new RuntimeError('The round filter only supports the "common", "ceil", and "floor" methods.');
}
$value = (float) $value;
return $method($value * 10 ** $precision) / 10 ** $precision;
}
+4
View File
@@ -13,6 +13,8 @@
{{ ''|round(-1, 'floor')}}
{{ null|round(-1, 'floor')}}
{{ null|round }}
{{ null|round(2, 'ceil') }}
--DATA--
return []
--EXPECT--
@@ -28,3 +30,5 @@ return []
0
0
0
0