You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bug #31761 [TwigBridge] suggest Translation Component when TranslationExtension is used (nicolas-grekas)
This PR was merged into the 4.3 branch.
Discussion
----------
[TwigBridge] suggest Translation Component when TranslationExtension is used
| Q | A
| ------------- | ---
| Branch? | 4.3
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #31754
| License | MIT
| Doc PR | -
Commits
-------
d4a9e7e [TwigBridge] suggest Translation Component when TranslationExtension is used
Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Twig/Extension/TranslationExtension.php
+15-16Lines changed: 15 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -49,11 +49,19 @@ public function __construct($translator = null, NodeVisitorInterface $translatio
49
49
}
50
50
51
51
/**
52
-
* @deprecated since Symfony 4.2
52
+
* @return TranslatorInterface|null
53
53
*/
54
54
publicfunctiongetTranslator()
55
55
{
56
-
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED);
56
+
if (null === $this->translator) {
57
+
if (!interface_exists(TranslatorInterface::class)) {
58
+
thrownew \LogicException(sprintf('You cannot use the "%s" if the Translation Contracts are not available. Try running "composer require symfony/translation".', __CLASS__));
0 commit comments