1 | <?php |
||
16 | class AdminLocaleListener implements EventSubscriberInterface |
||
17 | { |
||
18 | /** |
||
19 | * @var TokenStorageInterface |
||
20 | */ |
||
21 | private $tokenStorage; |
||
22 | |||
23 | /** |
||
24 | * @var TranslatorInterface |
||
25 | */ |
||
26 | private $translator; |
||
27 | |||
28 | /** |
||
29 | * @var string |
||
30 | */ |
||
31 | private $defaultAdminLocale; |
||
32 | |||
33 | /** |
||
34 | * @var string |
||
35 | */ |
||
36 | private $providerKey; |
||
37 | |||
38 | /** |
||
39 | * @var AdminRouteHelper |
||
40 | */ |
||
41 | private $adminRouteHelper; |
||
42 | |||
43 | /** |
||
44 | * @param TokenStorageInterface $tokenStorage |
||
45 | * @param TranslatorInterface $translator |
||
46 | * @param string $defaultAdminLocale |
||
47 | * @param AdminRouteHelper $adminRouteHelper |
||
48 | * @param string $providerKey Firewall name to check against |
||
49 | */ |
||
50 | 1 | public function __construct(TokenStorageInterface $tokenStorage, TranslatorInterface $translator, AdminRouteHelper $adminRouteHelper, $defaultAdminLocale, $providerKey = 'main') |
|
58 | |||
59 | /** |
||
60 | * onKernelRequest |
||
61 | * |
||
62 | * @param GetResponseEvent $event |
||
63 | */ |
||
64 | 1 | public function onKernelRequest(GetResponseEvent $event) |
|
79 | |||
80 | /** |
||
81 | * @param TokenInterface $token |
||
|
|||
82 | * @param $providerKey |
||
83 | * |
||
84 | * @return bool |
||
85 | */ |
||
86 | 1 | private function isAdminToken($providerKey, TokenInterface $token = null) |
|
90 | |||
91 | /** |
||
92 | * getSubscribedEvents |
||
93 | */ |
||
94 | 4 | public static function getSubscribedEvents() |
|
101 | } |
||
102 |
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.