getEmailByUsername($username)) { throw new UserNotFoundException(); } $user = \User::createFromLogin($email); if (!isset($user)) { throw new UserNotFoundException(); } return new TwoFactorUser($user->id, $user->email, $user->passw, ['ROLE_USER'], $user); } public function supportsClass($class): bool { return $class === TwoFactorUser::class || $class === User::class; } }