Skip to content

Commit

Permalink
Fix deprecation in Twig 3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
emodric committed Sep 6, 2024
1 parent ad3f5a0 commit b3068f0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Twig\Attribute\YieldReady;
use Twig\Compiler;
use Twig\Environment;
use Twig\Node\Expression\AbstractExpression;
use Twig\Node\Node;

Expand All @@ -14,7 +15,9 @@ final class DefaultContext extends Node
{
public function __construct(AbstractExpression $expr, int $line = 0, ?string $tag = null)

Check failure on line 16 in bundles/LayoutsBundle/Templating/Twig/Node/DefaultContext.php

View workflow job for this annotation

GitHub Actions / phpstan

Netgen\Bundle\LayoutsBundle\Templating\Twig\Node\DefaultContext::__construct() does not call parent constructor from Twig\Node\Node.
{
parent::__construct(['expr' => $expr], [], $line, $tag);
Environment::MAJOR_VERSION === 3 && Environment::MINOR_VERSION < 12 ?

Check failure on line 18 in bundles/LayoutsBundle/Templating/Twig/Node/DefaultContext.php

View workflow job for this annotation

GitHub Actions / phpstan

Comparison operation "<" between 12 and 12 is always false.

Check failure on line 18 in bundles/LayoutsBundle/Templating/Twig/Node/DefaultContext.php

View workflow job for this annotation

GitHub Actions / phpstan

Result of && is always false.

Check failure on line 18 in bundles/LayoutsBundle/Templating/Twig/Node/DefaultContext.php

View workflow job for this annotation

GitHub Actions / phpstan

Strict comparison using === between 3 and 3 will always evaluate to true.
parent::__construct(['expr' => $expr], [], $line, $tag) :
parent::__construct(['expr' => $expr], [], $line);
}

public function compile(Compiler $compiler): void
Expand Down
4 changes: 3 additions & 1 deletion bundles/LayoutsBundle/Templating/Twig/Node/RenderZone.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ public function __construct(AbstractExpression $zone, ?AbstractExpression $conte
$nodes['context'] = $context;
}

parent::__construct($nodes, [], $line, $tag);
Environment::MAJOR_VERSION === 3 && Environment::MINOR_VERSION < 12 ?

Check failure on line 29 in bundles/LayoutsBundle/Templating/Twig/Node/RenderZone.php

View workflow job for this annotation

GitHub Actions / phpstan

Comparison operation "<" between 12 and 12 is always false.

Check failure on line 29 in bundles/LayoutsBundle/Templating/Twig/Node/RenderZone.php

View workflow job for this annotation

GitHub Actions / phpstan

Result of && is always false.

Check failure on line 29 in bundles/LayoutsBundle/Templating/Twig/Node/RenderZone.php

View workflow job for this annotation

GitHub Actions / phpstan

Strict comparison using === between 3 and 3 will always evaluate to true.
parent::__construct($nodes, [], $line, $tag) :
parent::__construct($nodes, [], $line);
}

public function compile(Compiler $compiler): void
Expand Down

0 comments on commit b3068f0

Please sign in to comment.