src/Authentication/AuthenticationService.php
public function hasIdentity()
    {
        $storageCheck = !$this->getStorage()->isEmpty();
        if (!$storageCheck) {
            return false;
        }

        return $this->getIdentity() instanceof User;
    }
public function hasIdentity()
    {
        $storageCheck = !$this->getStorage()->isEmpty();
        if (!$storageCheck) {
            return false;
        }

        return $this->getIdentity() instanceof User;
    }
Returns true if and only if an identity is available

@return bool