fixed bad merge

This commit is contained in:
Fabien Potencier
2018-07-31 11:41:44 +02:00
parent 0837fda1b7
commit 43c558088e
2 changed files with 24 additions and 0 deletions
+13
View File
@@ -386,6 +386,19 @@ final class Twig_ExtensionSet
return $this->tests[$name];
}
foreach ($this->tests as $pattern => $test) {
$pattern = str_replace('\\*', '(.*?)', preg_quote($pattern, '#'), $count);
if ($count) {
if (preg_match('#^'.$pattern.'$#', $name, $matches)) {
array_shift($matches);
$test->setArguments($matches);
return $test;
}
}
}
return false;
}
+11
View File
@@ -23,6 +23,7 @@ class Twig_Test
private $name;
private $callable;
private $options;
private $arguments = array();
/**
* Creates a template test.
@@ -67,6 +68,16 @@ class Twig_Test
return $this->options['node_class'];
}
public function setArguments($arguments)
{
$this->arguments = $arguments;
}
public function getArguments()
{
return $this->arguments;
}
public function isVariadic()
{
return $this->options['is_variadic'];