Skip to content

Commit 9f11f19

Browse files
committed
Remove deprecated call to internal Parser::getParent(), check is already done when calling Parser::setParent(). Return EmptyNode like Twig ExtendsTokenParser does.
1 parent a4fb066 commit 9f11f19

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

Twig/TokenParser/ExtendsAdmingeneratedTokenParser.php

+2-5
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Admingenerator\GeneratorBundle\Twig\TokenParser;
44

55
use Twig\Error\SyntaxError;
6+
use Twig\Node\EmptyNode;
67
use Twig\Node\Expression\ConstantExpression;
78
use Twig\Node\Node;
89
use Twig\Token;
@@ -13,10 +14,6 @@ class ExtendsAdmingeneratedTokenParser extends AbstractTokenParser
1314

1415
public function parse(Token $token): ?Node
1516
{
16-
if (null !== $this->parser->getParent()) {
17-
throw new SyntaxError('Multiple extends tags are forbidden', $token->getLine());
18-
}
19-
2017
$templateParts = explode(':', $this->parser->getCurrentToken()->getValue()); //AcmeBundle:namespace:template.html.twig
2118
if (count($templateParts) !== 3) {
2219
list($bundle, $folder, $file) = explode('/', $this->parser->getCurrentToken()->getValue()); //@Acme/namespace/template.html.twig
@@ -32,7 +29,7 @@ public function parse(Token $token): ?Node
3229
$this->parser->setParent(new ConstantExpression($path,$token->getLine()));
3330
$this->parser->getStream()->expect(Token::BLOCK_END_TYPE);
3431

35-
return null;
32+
return new EmptyNode($token->getLine());
3633
}
3734

3835
public function getTag(): string

0 commit comments

Comments
 (0)