ExtendsTokenParser example

'{% sw_extends { template: "foo.html.twig" } %}{% block test %}extended{% endblock %}',
                [TemplateScopeDetector::DEFAULT_SCOPE],
                false,
            )
        );
    }

    public function testGetTag(): void
    {
        static::assertSame(
            'sw_extends',
            (new ExtendsTokenParser(
                $this->createMock(TemplateFinderInterface::class),
                $this->createMock(TemplateScopeDetector::class),
            ))->getTag()
        );
    }

    /** * @param string[] $scopes */
    private function parseTemplate(
        string $template,
        
private readonly TemplateFinder $finder,
        private readonly TemplateScopeDetector $templateScopeDetector,
    ) {
    }

    /** * @return TokenParserInterface[] */
    public function getTokenParsers(): array
    {
        return [
            new ExtendsTokenParser($this->finder, $this->templateScopeDetector),
            new IncludeTokenParser($this->finder),
            new ReturnNodeTokenParser(),
        ];
    }

    public function getFinder(): TemplateFinder
    {
        return $this->finder;
    }
}
public function getNumberFormat()
    {
        return $this->numberFormat;
    }

    public function getTokenParsers(): array
    {
        return [
            new ApplyTokenParser(),
            new ForTokenParser(),
            new IfTokenParser(),
            new ExtendsTokenParser(),
            new IncludeTokenParser(),
            new BlockTokenParser(),
            new UseTokenParser(),
            new MacroTokenParser(),
            new ImportTokenParser(),
            new FromTokenParser(),
            new SetTokenParser(),
            new FlushTokenParser(),
            new DoTokenParser(),
            new EmbedTokenParser(),
            new WithTokenParser(),
            
Home | Imprint | This part of the site doesn't use cookies.