mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-13 19:06:40 +00:00
Merge branch '2.x' into 3.x
* 2.x: Fix PHP 8 support
This commit is contained in:
@@ -51,8 +51,8 @@ function (with a step of ``1``, or ``-1`` if the start is greater than the end):
|
||||
Arguments
|
||||
---------
|
||||
|
||||
* ``start``: The first value of the sequence.
|
||||
* ``end``: The highest possible value of the sequence.
|
||||
* ``low``: The first value of the sequence.
|
||||
* ``high``: The highest possible value of the sequence.
|
||||
* ``step``: The increment between elements of the sequence.
|
||||
|
||||
.. _`range`: https://secure.php.net/range
|
||||
|
||||
@@ -152,7 +152,16 @@ abstract class CallExpression extends AbstractExpression
|
||||
$optionalArguments = [];
|
||||
$pos = 0;
|
||||
foreach ($callableParameters as $callableParameter) {
|
||||
$names[] = $name = $this->normalizeName($callableParameter->name);
|
||||
$name = $this->normalizeName($callableParameter->name);
|
||||
if (\PHP_VERSION_ID >= 80000 && 'range' === $callable) {
|
||||
if ('start' === $name) {
|
||||
$name = 'low';
|
||||
} elseif ('end' === $name) {
|
||||
$name = 'high';
|
||||
}
|
||||
}
|
||||
|
||||
$names[] = $name;
|
||||
|
||||
if (\array_key_exists($name, $parameters)) {
|
||||
if (\array_key_exists($pos, $parameters)) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
--TEST--
|
||||
"range" function
|
||||
--TEMPLATE--
|
||||
{{ range(start=0+1, end=10+0, step=2)|join(',') }}
|
||||
{{ range(low=0+1, high=10+0, step=2)|join(',') }}
|
||||
--DATA--
|
||||
return []
|
||||
--EXPECT--
|
||||
|
||||
Reference in New Issue
Block a user