trigger_deprecation('twig/twig','3.12','Returning "null" from "%s" is deprecated and forbidden by "TokenParserInterface".',$subparser::class);
}else{
$node->setNodeTag($subparser->getTag());
$rv[]=$node;
}
break;
default:
thrownewSyntaxError('The lexer or the parser ended up in an unsupported state.',$this->getCurrentToken()->getLine(),$this->stream->getSourceContext());
}
}
if(1===\count($rv)){
return$rv[0];
}
returnnewNode($rv,[],$lineno);
}
publicfunctiongetBlockStack():array
{
trigger_deprecation('twig/twig','3.12','Method "%s()" is deprecated.',__METHOD__);
thrownewSyntaxError(\sprintf("The block '%s' has already been defined line %d.",$name,$this->blocks[$name]->getTemplateLine()),$this->getCurrentToken()->getLine(),$this->blocks[$name]->getSourceContext());
thrownewSyntaxError('A template that extends another one cannot include content outside Twig blocks. Did you forget to put the content inside a {% block %} tag?',$node->getTemplateLine(),$this->stream->getSourceContext());
}
// bypass nodes that "capture" the output
if($nodeinstanceofNodeCaptureInterface){
// a "block" tag in such a node will serve as a block definition AND be displayed in place as well
return$node;
}
// "block" tags that are not captured (see above) are only used for defining
// the content of the block. In such a case, nesting it does not work as
// expected as the definition is not part of the default template code flow.
if($nested&&$nodeinstanceofBlockReferenceNode){
thrownewSyntaxError('A block definition cannot be nested under non-capturing nodes.',$node->getTemplateLine(),$this->stream->getSourceContext());
}
if($nodeinstanceofNodeOutputInterface){
returnnull;
}
// here, $nested means "being at the root level of a child template"
// we need to discard the wrapping "Node" for the "body" node