isDeleted()) { // the message passed to this exception is meant to be displayed to the user throw new CustomUserMessageAccountStatusException('Your account no longer exists.'); } } public function checkPostAuth(UserInterface $user): void { if (!$user instanceof AppUser) { return; } // user account is expired, the user may be notified if ($user->isExpired()) { throw new AccountExpiredException('...'); } } }