Total Complexity | 4 |
Total Lines | 39 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
14 | class UserDeleteAccountSubscriber extends UserSubscriber implements EventSubscriberInterface |
||
15 | { |
||
16 | |||
17 | /** |
||
18 | * @var Session |
||
19 | */ |
||
20 | private $session; |
||
21 | /** |
||
22 | * @var TokenStorageInterface |
||
23 | */ |
||
24 | private $tokenStorage; |
||
25 | |||
26 | public function __construct(SessionInterface $session, TokenStorageInterface $tokenStorage) |
||
27 | { |
||
28 | $this->session = $session; |
||
|
|||
29 | $this->tokenStorage = $tokenStorage; |
||
30 | } |
||
31 | |||
32 | public function deleteAccount(UserEvent $event) |
||
33 | { |
||
34 | $this->deleteFromDatabase($event); |
||
35 | } |
||
36 | |||
37 | public function removeSession() |
||
38 | { |
||
39 | $this->tokenStorage->setToken(null); |
||
40 | $this->session->invalidate(); |
||
41 | } |
||
42 | |||
43 | |||
44 | /** |
||
45 | * @return array The event names to listen to |
||
46 | */ |
||
47 | public static function getSubscribedEvents() |
||
53 | ], |
||
54 | ]; |
||
55 | } |
||
56 | } |
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a given class or a super-class is assigned to a property that is type hinted more strictly.
Either this assignment is in error or an instanceof check should be added for that assignment.