mirror of
https://github.com/twigphp/Twig.git
synced 2026-11-13 13:56:39 +00:00
Merge branch '2.x' into 3.x
* 2.x: tweaked the error message when using extends in a block/macro
This commit is contained in:
@@ -27,8 +27,10 @@ final class ExtendsTokenParser extends AbstractTokenParser
|
||||
{
|
||||
$stream = $this->parser->getStream();
|
||||
|
||||
if (!$this->parser->isMainScope()) {
|
||||
throw new SyntaxError('Cannot extend from a block.', $token->getLine(), $stream->getSourceContext());
|
||||
if ($this->parser->peekBlockStack()) {
|
||||
throw new SyntaxError('Cannot use "extend" in a block.', $token->getLine(), $stream->getSourceContext());
|
||||
} elseif (!$this->parser->isMainScope()) {
|
||||
throw new SyntaxError('Cannot use "extend" in a macro.', $token->getLine(), $stream->getSourceContext());
|
||||
}
|
||||
|
||||
if (null !== $this->parser->getParent()) {
|
||||
|
||||
Reference in New Issue
Block a user