-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
628 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,9 +52,10 @@ | |
use Symfony\Component\Routing\Generator\UrlGeneratorInterface as RoutingUrlGeneratorInterface; | ||
use Symfony\Component\Security\Acl\Model\DomainObjectInterface; | ||
use Symfony\Component\Security\Core\Exception\AccessDeniedException; | ||
use Symfony\Component\Translation\TranslatorInterface; | ||
use Symfony\Component\Translation\TranslatorInterface as DeprecatedTranslatorInterface; | ||
use Symfony\Component\Validator\Mapping\GenericMetadata; | ||
use Symfony\Component\Validator\Validator\ValidatorInterface; | ||
use Symfony\Contracts\Translation\TranslatorInterface; | ||
|
||
/** | ||
* @author Thomas Rabaix <[email protected]> | ||
|
@@ -309,7 +310,7 @@ abstract class AbstractAdmin implements AdminInterface, DomainObjectInterface, A | |
* | ||
* NEXT_MAJOR: remove this property | ||
* | ||
* @var \Symfony\Component\Translation\TranslatorInterface | ||
* @var DeprecatedTranslatorInterface|TranslatorInterface | ||
* | ||
* @deprecated since sonata-project/admin-bundle 3.9, to be removed with 4.0 | ||
*/ | ||
|
@@ -2455,8 +2456,10 @@ public function getTranslationDomain() | |
* NEXT_MAJOR: remove this method | ||
* | ||
* @deprecated since sonata-project/admin-bundle 3.9, to be removed with 4.0 | ||
* | ||
* @param DeprecatedTranslatorInterface|TranslatorInterface $translator | ||
*/ | ||
public function setTranslator(TranslatorInterface $translator) | ||
public function setTranslator($translator) | ||
{ | ||
$args = \func_get_args(); | ||
if (isset($args[1]) && $args[1]) { | ||
|
@@ -2466,6 +2469,16 @@ public function setTranslator(TranslatorInterface $translator) | |
), E_USER_DEPRECATED); | ||
} | ||
|
||
if (!$translator instanceof DeprecatedTranslatorInterface && !$translator instanceof TranslatorInterface) { | ||
throw new \TypeError(sprintf( | ||
'Argument 1 passed to "%s()" must be an instance of "%s" or "%s", %s given.', | ||
__METHOD__, | ||
DeprecatedTranslatorInterface::class, | ||
TranslatorInterface::class, | ||
\is_object($translator) ? 'instance of '.\get_class($translator) : \gettype($translator) | ||
)); | ||
} | ||
|
||
$this->translator = $translator; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.