diff --git a/lib/SimpleSAML/Metadata/SAMLBuilder.php b/lib/SimpleSAML/Metadata/SAMLBuilder.php
index 319f7800182b359cd946063cf5b1422e7be793bb..26f3a36d95a485acd1d10a131bfd1147453dd5c9 100644
--- a/lib/SimpleSAML/Metadata/SAMLBuilder.php
+++ b/lib/SimpleSAML/Metadata/SAMLBuilder.php
@@ -153,7 +153,10 @@ class SAMLBuilder
         $metadata = Configuration::loadFromArray($metadata, $metadata['entityid']);
         $defaultEndpoint = $metadata->getDefaultEndpoint('SingleSignOnService');
 
-        /** @psalm-var \SAML2\XML\md\RoleDescriptor $e */
+        /**
+         * @psalm-var \SAML2\XML\md\RoleDescriptor $e
+         * @psalm-suppress UndefinedClass
+         */
         $e = new SecurityTokenServiceType();
         $e->setLocation($defaultEndpoint['Location']);
 
diff --git a/lib/SimpleSAML/Session.php b/lib/SimpleSAML/Session.php
index 635b88b7e09c062a3a69139364673b1062f1c094..0bfadf6336fd42cb5a51bc25933e3ff31b5026c1 100644
--- a/lib/SimpleSAML/Session.php
+++ b/lib/SimpleSAML/Session.php
@@ -265,7 +265,6 @@ class Session implements \Serializable, Utils\ClearableState
 
         // check if we have stored a session stored with the session handler
         try {
-            /** @var \SimpleSAML\Session|null $session  Help Scrutinizer with the correct type */
             $session = self::getSession();
         } catch (\Exception $e) {
             /*
diff --git a/lib/SimpleSAML/Utils/EMail.php b/lib/SimpleSAML/Utils/EMail.php
index d485b6707c86ab9fd7ba82bfaa9f4a2fbcf70af7..d21c8ded1f82d0c1c6c1100cbeb83c04ee9a1e67 100644
--- a/lib/SimpleSAML/Utils/EMail.php
+++ b/lib/SimpleSAML/Utils/EMail.php
@@ -254,14 +254,7 @@ class EMail
         $config = Configuration::getInstance();
 
         $t = new Template($config, $template);
-        $twig = $t->getTwig();
-        if (!isset($twig)) {
-            throw new \Exception(
-                'Even though we explicitly configure that we want Twig,'
-                    . ' the Template class does not give us Twig. This is a bug.'
-            );
-        }
-        $result = $twig->render($template, [
+        $result = $t->getTwig()->render($template, [
             'subject' => $this->mail->Subject,
             'text' => $this->text,
             'data' => $this->data