public function refreshUser(UserInterface $user) { /** @var User $user */ $class = get_class($user); if (!$this->supportsClass($class)) { throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', $class)); } return $this->find($user->getId()); }