public function Twig_Extension_Core::parseTestExpression in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/twig/twig/lib/Twig/Extension/Core.php \Twig_Extension_Core::parseTestExpression()
1 call to Twig_Extension_Core::parseTestExpression()
- Twig_Extension_Core::parseNotTestExpression in vendor/
twig/ twig/ lib/ Twig/ Extension/ Core.php
File
- vendor/
twig/ twig/ lib/ Twig/ Extension/ Core.php, line 273
Class
Code
public function parseTestExpression(Twig_Parser $parser, Twig_NodeInterface $node) {
$stream = $parser
->getStream();
list($name, $test) = $this
->getTest($parser, $node
->getLine());
if ($test instanceof Twig_SimpleTest && $test
->isDeprecated()) {
$message = sprintf('Twig Test "%s" is deprecated', $name);
if ($test
->getAlternative()) {
$message .= sprintf('. Use "%s" instead', $test
->getAlternative());
}
$message .= sprintf(' in %s at line %d.', $stream
->getFilename(), $stream
->getCurrent()
->getLine());
@trigger_error($message, E_USER_DEPRECATED);
}
$class = $this
->getTestNodeClass($parser, $test);
$arguments = null;
if ($stream
->test(Twig_Token::PUNCTUATION_TYPE, '(')) {
$arguments = $parser
->getExpressionParser()
->parseArguments(true);
}
return new $class($node, $name, $arguments, $parser
->getCurrentToken()
->getLine());
}