From cb379b0fc9e194d818ead57bb1f381a4e03f2ab8 Mon Sep 17 00:00:00 2001
From: Tim van Dijen <tvdijen@gmail.com>
Date: Tue, 9 Jul 2019 21:32:27 +0200
Subject: [PATCH] Fix Psalm-issues in Session.php

---
 lib/SimpleSAML/Session.php | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/lib/SimpleSAML/Session.php b/lib/SimpleSAML/Session.php
index fd847cb03..dafefa952 100644
--- a/lib/SimpleSAML/Session.php
+++ b/lib/SimpleSAML/Session.php
@@ -32,7 +32,6 @@ class Session implements \Serializable, Utils\ClearableState
      */
     const DATA_TIMEOUT_SESSION_END = 'sessionEndTimeout';
 
-
     /**
      * The list of loaded session objects.
      *
@@ -42,13 +41,12 @@ class Session implements \Serializable, Utils\ClearableState
      */
     private static $sessions = [];
 
-
     /**
      * This variable holds the instance of the session - Singleton approach.
      *
      * Warning: do not set the instance manually, call Session::load() instead.
      */
-    private static $instance = null;
+    private static $instance;
 
     /**
      * The global configuration.
@@ -169,10 +167,11 @@ class Session implements \Serializable, Utils\ClearableState
              * Initialize the session ID. It might be that we have a session cookie but we couldn't load the session.
              * If that's the case, use that ID. If not, create a new ID.
              */
-            $this->sessionId = $sh->getCookieSessionId();
-            if ($this->sessionId === null) {
-                $this->sessionId = $sh->newSessionId();
+            $sessionId = $sh->getCookieSessionId();
+            if ($sessionId === null) {
+                $sessionId = $sh->newSessionId();
             }
+            $this->sessionId = $sessionId;
         } else {
             // regular session
             $sh = SessionHandler::getSessionHandler();
@@ -321,6 +320,7 @@ class Session implements \Serializable, Utils\ClearableState
         }
 
         // we must have a session now, either regular or transient
+        /** @var \SimpleSAML\Session */
         return self::$instance;
     }
 
-- 
GitLab