mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-12 10:26:32 +00:00
modified code to use variadics when possible
This commit is contained in:
@@ -103,9 +103,8 @@ class Twig_Compiler
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function write()
|
||||
public function write(... $strings)
|
||||
{
|
||||
$strings = func_get_args();
|
||||
foreach ($strings as $string) {
|
||||
$this->source .= str_repeat(' ', $this->indentation * 4).$string;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ final class Twig_Extension_Debug extends Twig_Extension
|
||||
}
|
||||
}
|
||||
|
||||
function twig_var_dump(Twig_Environment $env, $context)
|
||||
function twig_var_dump(Twig_Environment $env, $context, ...$vars)
|
||||
{
|
||||
if (!$env->isDebug()) {
|
||||
return;
|
||||
@@ -37,8 +37,7 @@ function twig_var_dump(Twig_Environment $env, $context)
|
||||
|
||||
ob_start();
|
||||
|
||||
$count = func_num_args();
|
||||
if (2 === $count) {
|
||||
if (!$vars) {
|
||||
$vars = array();
|
||||
foreach ($context as $key => $value) {
|
||||
if (!$value instanceof Twig_Template) {
|
||||
@@ -48,9 +47,7 @@ function twig_var_dump(Twig_Environment $env, $context)
|
||||
|
||||
var_dump($vars);
|
||||
} else {
|
||||
for ($i = 2; $i < $count; ++$i) {
|
||||
var_dump(func_get_arg($i));
|
||||
}
|
||||
var_dump(...$vars);
|
||||
}
|
||||
|
||||
return ob_get_clean();
|
||||
|
||||
Reference in New Issue
Block a user