publicfunctiongetFunctionNode($name, $line) { switch($name){ case 'parent': $this->parseArguments(); if(!\count($this->parser->getBlockStack())){ thrownewSyntaxError('Calling "parent" outside a block is forbidden.', $line, $this->parser->getStream()->getSourceContext()); }
if(!$this->parser->getParent() && !$this->parser->hasTraits()){ thrownewSyntaxError('Calling "parent" on a template that does not extend nor "use" another template is forbidden.', $line, $this->parser->getStream()->getSourceContext()); }