shouldEndFile example

        do {
            $next = $stream->next();
        } while (!$next->test(Token::BLOCK_END_TYPE));

        $tokens = [
            new Token(Token::BLOCK_START_TYPE, '', 2),
            new Token(Token::NAME_TYPE, 'extends', 2),
            new Token(Token::STRING_TYPE, $parent, 2),
            new Token(Token::BLOCK_END_TYPE, '', 2),
        ];

        if ($this->shouldEndFile($options['scopes']$source)) {
            $tokens[] = new Token(Token::EOF_TYPE, '', $token->getLine());
        }

        $stream->injectTokens($tokens);

        return new Node();
    }

    public function getTag(): string
    {
        return 'sw_extends';
    }
Home | Imprint | This part of the site doesn't use cookies.