mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-14 03:16:34 +00:00
bumped minimum version to PHP 5.6
This commit is contained in:
@@ -8,7 +8,6 @@ cache:
|
||||
- $HOME/.composer/cache/files
|
||||
|
||||
php:
|
||||
- 5.5
|
||||
- 5.6
|
||||
- 7.0
|
||||
- 7.1
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* removed Twig_Autoloader (use Composer instead)
|
||||
* removed `true` as an equivalent to `html` for the auto-escaping strategy
|
||||
* removed pre-1.8 autoescape tag syntax
|
||||
* dropped support for PHP 5.2, 5.3, and 5.4
|
||||
* dropped support for PHP 5.2, 5.3, 5.4, and 5.5
|
||||
* removed the ability to register a global variable after the runtime or the extensions have been initialized
|
||||
* improved the performance of the filesystem loader
|
||||
* removed features that were deprecated in 1.x
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@
|
||||
"forum": "https://groups.google.com/forum/#!forum/twig-users"
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.5",
|
||||
"php": "^5.6|^7.0",
|
||||
"symfony/polyfill-mbstring": "~1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ Slim, Yii, Laravel, Codeigniter and Kohana — just to name a few.
|
||||
Prerequisites
|
||||
-------------
|
||||
|
||||
Twig needs at least **PHP 5.5.0** to run.
|
||||
Twig needs at least **PHP 5.6.0** to run.
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
+4
-18
@@ -49,15 +49,12 @@ class Twig_Node_Macro extends Twig_Node
|
||||
}
|
||||
}
|
||||
|
||||
if (PHP_VERSION_ID >= 50600) {
|
||||
if ($count) {
|
||||
$compiler->raw(', ');
|
||||
}
|
||||
|
||||
$compiler->raw('...$__varargs__');
|
||||
if ($count) {
|
||||
$compiler->raw(', ');
|
||||
}
|
||||
|
||||
$compiler
|
||||
->raw('...$__varargs__')
|
||||
->raw(")\n")
|
||||
->write("{\n")
|
||||
->indent()
|
||||
@@ -83,19 +80,8 @@ class Twig_Node_Macro extends Twig_Node
|
||||
->raw(' => ')
|
||||
;
|
||||
|
||||
if (PHP_VERSION_ID >= 50600) {
|
||||
$compiler->raw("\$__varargs__,\n");
|
||||
} else {
|
||||
$compiler
|
||||
->raw('func_num_args() > ')
|
||||
->repr($count)
|
||||
->raw(' ? array_slice(func_get_args(), ')
|
||||
->repr($count)
|
||||
->raw(") : array(),\n")
|
||||
;
|
||||
}
|
||||
|
||||
$compiler
|
||||
->raw("\$__varargs__,\n")
|
||||
->outdent()
|
||||
->write("));\n\n")
|
||||
->write("\$blocks = array();\n\n")
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
--TEST--
|
||||
"url_encode" filter
|
||||
--CONDITION--
|
||||
defined('PHP_QUERY_RFC3986')
|
||||
--TEMPLATE--
|
||||
{{ {foo: "bar", number: 3, "spéßi%l": "e%c0d@d", "spa ce": ""}|url_encode }}
|
||||
{{ {foo: "bar", number: 3, "spéßi%l": "e%c0d@d", "spa ce": ""}|url_encode|raw }}
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
--TEST--
|
||||
"url_encode" filter for PHP < 5.4 and HHVM
|
||||
--CONDITION--
|
||||
defined('PHP_QUERY_RFC3986')
|
||||
--TEMPLATE--
|
||||
{{ {foo: "bar", number: 3, "spéßi%l": "e%c0d@d", "spa ce": ""}|url_encode }}
|
||||
{{ {foo: "bar", number: 3, "spéßi%l": "e%c0d@d", "spa ce": ""}|url_encode|raw }}
|
||||
{{ {}|url_encode|default("default") }}
|
||||
{{ 'spéßi%le%c0d@dspa ce'|url_encode }}
|
||||
--DATA--
|
||||
return array()
|
||||
--EXPECT--
|
||||
foo=bar&number=3&sp%C3%A9%C3%9Fi%25l=e%25c0d%40d&spa%20ce=
|
||||
foo=bar&number=3&sp%C3%A9%C3%9Fi%25l=e%25c0d%40d&spa%20ce=
|
||||
default
|
||||
sp%C3%A9%C3%9Fi%25le%25c0d%40dspa%20ce
|
||||
@@ -31,23 +31,15 @@ class Twig_Tests_Node_MacroTest extends Twig_Test_NodeTestCase
|
||||
), array(), 1);
|
||||
$node = new Twig_Node_Macro('foo', $body, $arguments, 1);
|
||||
|
||||
if (PHP_VERSION_ID >= 50600) {
|
||||
$declaration = ', ...$__varargs__';
|
||||
$varargs = '$__varargs__';
|
||||
} else {
|
||||
$declaration = '';
|
||||
$varargs = 'func_num_args() > 2 ? array_slice(func_get_args(), 2) : array()';
|
||||
}
|
||||
|
||||
return array(
|
||||
array($node, <<<EOF
|
||||
// line 1
|
||||
public function macro_foo(\$__foo__ = null, \$__bar__ = "Foo"$declaration)
|
||||
public function macro_foo(\$__foo__ = null, \$__bar__ = "Foo", ...\$__varargs__)
|
||||
{
|
||||
\$context = \$this->env->mergeGlobals(array(
|
||||
"foo" => \$__foo__,
|
||||
"bar" => \$__bar__,
|
||||
"varargs" => $varargs,
|
||||
"varargs" => \$__varargs__,
|
||||
));
|
||||
|
||||
\$blocks = array();
|
||||
|
||||
Reference in New Issue
Block a user