mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-17 04:46:49 +00:00
Merge branch '1.x' into 2.x
* 1.x: fixed tests added missing information in the precedence paragraph Add missing ] fixed float representation in compiled templates
This commit is contained in:
@@ -135,6 +135,7 @@
|
||||
|
||||
* switched generated code to use the PHP short array notation
|
||||
* dropped PHP 5.3 support
|
||||
* fixed float representation in compiled templates
|
||||
* added a second argument to the join filter (last separator configuration)
|
||||
|
||||
* 1.36.0 (2018-12-16)
|
||||
|
||||
+6
-5
@@ -550,11 +550,12 @@ even if you're not working with PHP you should feel comfortable with it.
|
||||
|
||||
.. note::
|
||||
|
||||
The operator precedence is as follows, with the lowest-precedence
|
||||
operators listed first: ``b-and``, ``b-xor``, ``b-or``, ``or``, ``and``,
|
||||
``==``, ``!=``, ``<``, ``>``, ``>=``, ``<=``, ``in``, ``matches``,
|
||||
``starts with``, ``ends with``, ``..``, ``+``, ``-``, ``~``, ``*``, ``/``,
|
||||
``//``, ``%``, ``is``, ``**``, ``|``, ``[]``, and ``.``:
|
||||
The operator precedence is as follows, with the lowest-precedence operators
|
||||
listed first: ``?:`` (ternary operator), ``b-and``, ``b-xor``, ``b-or``,
|
||||
``or``, ``and``, ``==``, ``!=``, ``<``, ``>``, ``>=``, ``<=``, ``in``,
|
||||
``matches``, ``starts with``, ``ends with``, ``..``, ``+``, ``-``, ``~``,
|
||||
``*``, ``/``, ``//``, ``%``, ``is`` (tests), ``**``, ``??``, ``|``
|
||||
(filters), ``[]``, and ``.``.
|
||||
|
||||
.. code-block:: jinja
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@ class Twig_Compiler
|
||||
setlocale(LC_NUMERIC, 'C');
|
||||
}
|
||||
|
||||
$this->raw($value);
|
||||
$this->raw(var_export($value, true));
|
||||
|
||||
if (false !== $locale) {
|
||||
setlocale(LC_NUMERIC, $locale);
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
Twig compiles floats properly
|
||||
--CONDITION--
|
||||
version_compare(phpversion(), '7.0.0', '>=')
|
||||
--TEMPLATE--
|
||||
{% set val2 = 0.0 %}
|
||||
|
||||
{{ val is same as (0.0) ? 'Yes' : 'No' }}
|
||||
{{ val2 is same as (0.0) ? 'Yes' : 'No' }}
|
||||
{{ val is same as (val2) ? 'Yes' : 'No' }}
|
||||
--DATA--
|
||||
return array('val' => 0.0)
|
||||
--EXPECT--
|
||||
Yes
|
||||
Yes
|
||||
Yes
|
||||
Reference in New Issue
Block a user