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
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