getRaw(); $subject = trim((string) $user->getId()); // No stable subject means nothing to bind an account to, and the // email is not an acceptable substitute. Refuse rather than fall // back — falling back is the bug. if ($subject === '') { return null; } $email = $user->getEmail(); $email = is_string($email) && trim($email) !== '' ? trim($email) : null; return new self( provider: $provider, subject: $subject, email: $email, emailVerified: $email !== null && match ($provider) { SocialProvider::Google, SocialProvider::LinkedIn, SocialProvider::Oidc => ($raw['email_verified'] ?? false) === true || ($raw['email_verified'] ?? null) === 'true', SocialProvider::Github => true, SocialProvider::Microsoft => is_string($settings->tenant_id) && ($raw['tid'] ?? null) === $settings->tenant_id && (($raw['xms_edov'] ?? null) === true || ($raw['xms_edov'] ?? null) === 'true'), SocialProvider::Facebook => false, }, name: is_string($user->getName()) && trim($user->getName()) !== '' ? trim($user->getName()) : ($user->getNickname() ?: $email), ); } }