mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-17 21:07:18 +00:00
added null as an alias to none and made TRUE, FALSE, and NONE equivalent to true, false, and none
This commit is contained in:
@@ -4,6 +4,8 @@ Flush your cache after upgrading.
|
||||
|
||||
Changes:
|
||||
|
||||
* added null as an alias for none
|
||||
* made TRUE, FALSE, NONE equivalent to their lowercase counterparts
|
||||
* wrapped all runtime exceptions with Twig_Error_Runtime and added logic to guess the template name and line
|
||||
* moved display() method to Twig_Template (generated templates should now use doDisplay() instead)
|
||||
|
||||
|
||||
@@ -117,14 +117,19 @@ class Twig_ExpressionParser
|
||||
$this->parser->getStream()->next();
|
||||
switch ($token->getValue()) {
|
||||
case 'true':
|
||||
case 'TRUE':
|
||||
$node = new Twig_Node_Expression_Constant(true, $token->getLine());
|
||||
break;
|
||||
|
||||
case 'false':
|
||||
case 'FALSE':
|
||||
$node = new Twig_Node_Expression_Constant(false, $token->getLine());
|
||||
break;
|
||||
|
||||
case 'none':
|
||||
case 'NONE':
|
||||
case 'null':
|
||||
case 'NULL':
|
||||
$node = new Twig_Node_Expression_Constant(null, $token->getLine());
|
||||
break;
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
--TEST--
|
||||
Twig supports literals
|
||||
--TEMPLATE--
|
||||
1 {{ true }}
|
||||
2 {{ TRUE }}
|
||||
3 {{ false }}
|
||||
4 {{ FALSE }}
|
||||
5 {{ none }}
|
||||
6 {{ NONE }}
|
||||
7 {{ null }}
|
||||
8 {{ NULL }}
|
||||
--DATA--
|
||||
return array()
|
||||
--EXPECT--
|
||||
1 1
|
||||
2 1
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
Reference in New Issue
Block a user