src/Identity/Voter/DeletedVoter.php
protected function voteOnAttribute($attribute, $subject, TokenInterface $token)
    {
        $user = $token->getUser();

        if ($user instanceof \Symfony\Component\Security\Core\User\User && in_array('ROLE_SYSTEM', $user->getRoles())) {
            return true;
        }

        if (!$user instanceof User) {
            return false;
        }

        if (in_array($user->getIdentity()->getType(), [Identity::SYSTEM, Identity::STAFF], true)) {
            return true;
        }

        if (!$subject->getDeleted()) {
            return true;
        }

        return false;
    }
protected function voteOnAttribute($attribute, $subject, TokenInterface $token)
    {
        $user = $token->getUser();

        if ($user instanceof \Symfony\Component\Security\Core\User\User && in_array('ROLE_SYSTEM', $user->getRoles())) {
            return true;
        }

        if (!$user instanceof User) {
            return false;
        }

        if (in_array($user->getIdentity()->getType(), [Identity::SYSTEM, Identity::STAFF], true)) {
            return true;
        }

        if (!$subject->getDeleted()) {
            return true;
        }

        return false;
    }
{@inheritdoc}