From 4696eeba1dcf6038b178dbd9387f9d41a090bb71 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 26 Aug 2024 09:30:21 +0200 Subject: [PATCH] Remove deprecated code --- src/Parser.php | 50 ++------------------------------------------------ 1 file changed, 2 insertions(+), 48 deletions(-) diff --git a/src/Parser.php b/src/Parser.php index d3f9710f5..6b5df3c10 100644 --- a/src/Parser.php +++ b/src/Parser.php @@ -35,7 +35,7 @@ class Parser { private array $stack = []; private TokenStream $stream; - private ?Node $parent; + private ?Node $parent = null; /** * @var NodeVisitorInterface[]|null */ @@ -206,13 +206,6 @@ class Parser return new Node($rv, [], $lineno); } - public function getBlockStack(): array - { - trigger_deprecation('twig/twig', '3.12', 'Method "%s()" is deprecated.', __METHOD__); - - return $this->blockStack; - } - public function peekBlockStack() { return $this->blockStack[\count($this->blockStack) - 1] ?? null; @@ -228,20 +221,6 @@ class Parser $this->blockStack[] = $name; } - public function hasBlock(string $name): bool - { - trigger_deprecation('twig/twig', '3.12', 'Method "%s()" is deprecated.', __METHOD__); - - return isset($this->blocks[$name]); - } - - public function getBlock(string $name): Node - { - trigger_deprecation('twig/twig', '3.12', 'Method "%s()" is deprecated.', __METHOD__); - - return $this->blocks[$name]; - } - public function setBlock(string $name, BlockNode $value): void { if (isset($this->blocks[$name])) { @@ -251,13 +230,6 @@ class Parser $this->blocks[$name] = new BodyNode([$value], [], $value->getTemplateLine()); } - public function hasMacro(string $name): bool - { - trigger_deprecation('twig/twig', '3.12', 'Method "%s()" is deprecated.', __METHOD__); - - return isset($this->macros[$name]); - } - public function setMacro(string $name, MacroNode $node): void { $this->macros[$name] = $node; @@ -268,13 +240,6 @@ class Parser $this->traits[] = $trait; } - public function hasTraits(): bool - { - trigger_deprecation('twig/twig', '3.12', 'Method "%s()" is deprecated.', __METHOD__); - - return \count($this->traits) > 0; - } - public function embedTemplate(ModuleNode $template) { $template->setIndex(mt_rand()); @@ -313,24 +278,13 @@ class Parser return $this->expressionParser; } - public function getParent(): ?Node - { - trigger_deprecation('twig/twig', '3.12', 'Method "%s()" is deprecated.', __METHOD__); - - return $this->parent; - } - public function hasInheritance() { return $this->parent || 0 < \count($this->traits); } - public function setParent(?Node $parent): void + public function setParent(Node $parent): void { - if (null === $parent) { - trigger_deprecation('twig/twig', '3.12', 'Passing "null" to "%s()" is deprecated.', __METHOD__); - } - if (null !== $this->parent) { throw new SyntaxError('Multiple extends tags are forbidden.', $parent->getTemplateLine(), $parent->getSourceContext()); }