mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-15 11:56:50 +00:00
Floor - use cast and not intval
This commit is contained in:
committed by
Fabien Potencier
parent
ffa2b812b0
commit
39d46acf7d
@@ -12,9 +12,9 @@ class Twig_Node_Expression_Binary_FloorDiv extends Twig_Node_Expression_Binary
|
|||||||
{
|
{
|
||||||
public function compile(Twig_Compiler $compiler)
|
public function compile(Twig_Compiler $compiler)
|
||||||
{
|
{
|
||||||
$compiler->raw('intval(floor(');
|
$compiler->raw('(int) floor(');
|
||||||
parent::compile($compiler);
|
parent::compile($compiler);
|
||||||
$compiler->raw('))');
|
$compiler->raw(')');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function operator(Twig_Compiler $compiler)
|
public function operator(Twig_Compiler $compiler)
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class Twig_Tests_Node_Expression_Binary_FloorDivTest extends Twig_Test_NodeTestC
|
|||||||
$node = new Twig_Node_Expression_Binary_FloorDiv($left, $right, 1);
|
$node = new Twig_Node_Expression_Binary_FloorDiv($left, $right, 1);
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
array($node, 'intval(floor((1 / 2)))'),
|
array($node, '(int) floor((1 / 2))'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user