1 | <?php |
||
18 | class AdminLocaleListener implements EventSubscriberInterface |
||
19 | { |
||
20 | /** |
||
21 | * @var TokenStorageInterface |
||
22 | */ |
||
23 | private $tokenStorage; |
||
24 | |||
25 | /** |
||
26 | * @var TranslatorInterface |
||
27 | */ |
||
28 | private $translator; |
||
29 | |||
30 | /** |
||
31 | * @var string |
||
32 | */ |
||
33 | private $defaultAdminLocale; |
||
34 | |||
35 | /** |
||
36 | * @var string |
||
37 | */ |
||
38 | private $providerKey; |
||
39 | |||
40 | /** |
||
41 | * @var AdminRouteHelper |
||
42 | */ |
||
43 | private $adminRouteHelper; |
||
44 | |||
45 | /** |
||
46 | * @param TokenStorageInterface $tokenStorage |
||
47 | * @param TranslatorInterface $translator |
||
48 | * @param string $defaultAdminLocale |
||
49 | * @param AdminRouteHelper $adminRouteHelper |
||
50 | * @param string $providerKey Firewall name to check against |
||
51 | */ |
||
52 | public function __construct(TokenStorageInterface $tokenStorage, TranslatorInterface $translator, AdminRouteHelper $adminRouteHelper, $defaultAdminLocale, $providerKey = 'main') |
||
60 | |||
61 | /** |
||
62 | * onKernelRequest |
||
63 | * |
||
64 | * @param GetResponseEvent $event |
||
65 | */ |
||
66 | public function onKernelRequest(GetResponseEvent $event) |
||
81 | |||
82 | /** |
||
83 | * @param TokenInterface $token |
||
|
|||
84 | * @param $providerKey |
||
85 | * |
||
86 | * @return bool |
||
87 | */ |
||
88 | private function isAdminToken($providerKey, TokenInterface $token = null) |
||
92 | |||
93 | /** |
||
94 | * getSubscribedEvents |
||
95 | */ |
||
96 | static public function getSubscribedEvents() |
||
103 | } |
||
104 |
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.