Skip to content

Commit 79bc5b7

Browse files
committed
bug #37687 Fix getTranslationNodeVisitor() return type (dbrekelmans)
This PR was merged into the 5.2-dev branch. Discussion ---------- Fix getTranslationNodeVisitor() return type | Q | A | ------------- | --- | Branch? | master | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #37686 | License | MIT | Doc PR | - When constructing the `TranslationExtension` with any `NodeVisitorInterface` other than `TranslationNodeVisitor`, you will get a type error when calling `getTranslationNodeVisitor()`. This PR fixes that by extracting a new `TranslationNodeVisitorInterface`. Commits ------- c134425 Fix getTranslationNodeVisitor() return type
2 parents e411c96 + c134425 commit 79bc5b7

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

UPGRADE-5.2.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ TwigBundle
1616

1717
* Deprecated the public `twig` service to private.
1818

19+
TwigBridge
20+
----------
21+
22+
* Changed 2nd argument type of `TranslationExtension::__construct()` to `TranslationNodeVisitor`
23+
1924
Validator
2025
---------
2126

src/Symfony/Bridge/Twig/Extension/TranslationExtension.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
use Symfony\Contracts\Translation\TranslatorInterface;
1919
use Symfony\Contracts\Translation\TranslatorTrait;
2020
use Twig\Extension\AbstractExtension;
21-
use Twig\NodeVisitor\NodeVisitorInterface;
2221
use Twig\TwigFilter;
2322

2423
// Help opcache.preload discover always-needed symbols
@@ -34,7 +33,7 @@ final class TranslationExtension extends AbstractExtension
3433
private $translator;
3534
private $translationNodeVisitor;
3635

37-
public function __construct(TranslatorInterface $translator = null, NodeVisitorInterface $translationNodeVisitor = null)
36+
public function __construct(TranslatorInterface $translator = null, TranslationNodeVisitor $translationNodeVisitor = null)
3837
{
3938
$this->translator = $translator;
4039
$this->translationNodeVisitor = $translationNodeVisitor;

0 commit comments

Comments
 (0)