security->getUser(); } public function getUser(): User { $user = $this->security->getUser(); if (!$user instanceof User) { throw new \LogicException(sprintf('authenticated user should be an instance of %s, %s given', User::class, null !== $user ? $user::class : self::class)); } return $user; } public function isGranted($attribute, $subject = null): bool { return $this->security->isGranted($attribute, $subject); } public function getToken(): ?TokenInterface { return $this->security->getToken(); } }