if($this->parser->peekBlockStack()){ thrownewSyntaxError('Cannot use "extend" in a block.', $token->getLine(), $stream->getSourceContext()); }elseif(!$this->parser->isMainScope()){ thrownewSyntaxError('Cannot use "extend" in a macro.', $token->getLine(), $stream->getSourceContext()); }
if(!$template instanceof ConstantExpression){ thrownewSyntaxError('The template references in a "use" statement must be a string.', $stream->getCurrent()->getLine(), $stream->getSourceContext()); }
if(!class_exists($mainCls, false)){ /* Last line of defense if either $this->bcWriteCacheFile was used,
* $this->cache is implemented as a no-op or we have a race condition
* where the cache was cleared between the above calls to write to and load from
* the cache.
*/ eval('?>'.$content); }
// in a sandbox tag, only include tags are allowed
if(!$body instanceof IncludeNode){ foreach($bodyas$node){ if($node instanceof TextNode && ctype_space($node->getAttribute('data'))){ continue; }
if(!$node instanceof IncludeNode){ thrownewSyntaxError('Only "include" tags are allowed within a "sandbox" section.', $node->getTemplateLine(), $stream->getSourceContext()); } } }
if($stream->test('into')){ // {% trans into "fr" %}
$stream->next(); $locale = $this->parser->getExpressionParser()->parseExpression(); }elseif(!$stream->test(Token::BLOCK_END_TYPE)){ thrownewSyntaxError('Unexpected token. Twig was looking for the "with", "from", or "into" keyword.', $stream->getCurrent()->getLine(), $stream->getSourceContext()); } }
if(!$body instanceof TextNode && !$body instanceof AbstractExpression){ thrownewSyntaxError('A message inside a trans tag must be a simple text.', $body->getTemplateLine(), $stream->getSourceContext()); }
$this->script = newScript( 'simple-function-case.twig', file_get_contents(__DIR__ . '/_fixtures/simple-function-case/Resources/scripts/simple-function-case/simple-function-case.twig'), new \DateTimeImmutable() );