From 7731c790b0b7f16443d8cc1b60d06cb821122006 Mon Sep 17 00:00:00 2001
From: Tim van Dijen <tvdijen@gmail.com>
Date: Sat, 22 Feb 2020 20:05:43 +0100
Subject: [PATCH] Fix Psalm

---
 lib/SimpleSAML/Metadata/SAMLBuilder.php | 5 ++++-
 lib/SimpleSAML/Session.php              | 1 -
 lib/SimpleSAML/Utils/EMail.php          | 9 +--------
 3 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/lib/SimpleSAML/Metadata/SAMLBuilder.php b/lib/SimpleSAML/Metadata/SAMLBuilder.php
index 319f78001..26f3a36d9 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 635b88b7e..0bfadf633 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 d485b6707..d21c8ded1 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
-- 
GitLab