/** * @param GetResponseEvent $event */ public function onKernelRequest(GetResponseEvent $event) { if ($event->isMasterRequest() && $this->isCacheExpired()) { $lastUpdateTime = $this->storage->getLatestUpdatedAt(); if ($lastUpdateTime instanceof \DateTime) { $finder = new Finder(); $finder->files()->in($this->cacheDirectory . '/translations')->date('< ' . $lastUpdateTime->format('Y-m-d H:i:s')); if ($finder->count() > 0) { $this->translator->removeLocalesCacheFiles($this->managedLocales); } } } }