1 | <?php |
||
25 | class TranslationHistorySubscriber |
||
26 | { |
||
27 | /** |
||
28 | * @var TranslationHistoryManagerInterface |
||
29 | */ |
||
30 | private $translationHistoryManager; |
||
31 | |||
32 | /** |
||
33 | * @var SecurityContextInterface|TokenStorageInterface |
||
34 | */ |
||
35 | private $tokenStorage; |
||
36 | |||
37 | /** |
||
38 | * @param TranslationHistoryManagerInterface $translationHistoryManager |
||
39 | * @param SecurityContextInterface|TokenStorageInterface $tokenStorage |
||
40 | */ |
||
41 | 6 | public function __construct( |
|
42 | TranslationHistoryManagerInterface $translationHistoryManager, |
||
43 | $tokenStorage |
||
44 | ) { |
||
45 | 6 | $this->translationHistoryManager = $translationHistoryManager; |
|
46 | |||
47 | 6 | if (!$tokenStorage instanceof SecurityContextInterface && !$tokenStorage instanceof TokenStorageInterface) { |
|
|
|||
48 | throw new \InvalidArgumentException('Token storage must be an instance of Symfony\Component\Security\Core\SecurityContextInterface or Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface.'); |
||
49 | } |
||
50 | |||
51 | 6 | $this->tokenStorage = $tokenStorage; |
|
52 | 6 | } |
|
53 | |||
54 | /** |
||
55 | * Event-based update of the translation history. |
||
56 | * |
||
57 | * @param TranslationEvent $event The event triggering the update |
||
58 | * @param string $eventName The name of the triggered event |
||
59 | * |
||
60 | * @return TranslationHistoryInterface The new translation history entry |
||
61 | */ |
||
62 | 6 | public function updateHistory(TranslationEvent $event, $eventName = null) |
|
89 | } |
||
90 |
This error could be the result of:
1. Missing dependencies
PHP Analyzer uses your
composer.json
file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects thecomposer.json
to be in the root folder of your repository.Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the
require
orrequire-dev
section?2. Missing use statement
PHP does not complain about undefined classes in
ìnstanceof
checks. For example, the following PHP code will work perfectly fine:If you have not tested against this specific condition, such errors might go unnoticed.