diff --git a/modules/saml/lib/IdP/SAML2.php b/modules/saml/lib/IdP/SAML2.php
index 6dae8c4ca6a3b2de00bcbccb8cbc2d584b2fd2b2..9ed2e7b2c6e89ff48fadd391417b83453dc3a825 100644
--- a/modules/saml/lib/IdP/SAML2.php
+++ b/modules/saml/lib/IdP/SAML2.php
@@ -688,7 +688,7 @@ class SAML2
      * @param \SimpleSAML\Configuration $spMetadata The metadata of the SP.
      * @param array                     &$state The authentication state of the user.
      *
-     * @return string  The NameID value.
+     * @return string|null The NameID value.
      */
     private static function generateNameIdValue(
         Configuration $idpMetadata,