From 092968d71a8c6538e57d30cccdb0f67a3ff5c08e Mon Sep 17 00:00:00 2001
From: Tim van Dijen <tvdijen@gmail.com>
Date: Sun, 5 Aug 2018 12:54:47 +0200
Subject: [PATCH] Phpdoc & optimization

---
 lib/SimpleSAML/Session.php | 24 ++----------------------
 1 file changed, 2 insertions(+), 22 deletions(-)

diff --git a/lib/SimpleSAML/Session.php b/lib/SimpleSAML/Session.php
index 3432ca53b..cf4ff6e3b 100644
--- a/lib/SimpleSAML/Session.php
+++ b/lib/SimpleSAML/Session.php
@@ -105,7 +105,7 @@ class Session implements \Serializable
      *
      * @var array
      */
-    private $dataStore = null;
+    private $dataStore = array();
 
 
     /**
@@ -726,7 +726,7 @@ class Session implements \Serializable
      *
      * @param string $authority The authentication source that the user should be authenticated with.
      *
-     * @return true if the user has a valid session, false if not.
+     * @return bool True if the user has a valid session, false if not.
      */
     public function isValid($authority)
     {
@@ -837,10 +837,6 @@ class Session implements \Serializable
         assert(is_string($type));
         assert(is_string($id));
 
-        if (!is_array($this->dataStore)) {
-            return;
-        }
-
         if (!array_key_exists($type, $this->dataStore)) {
             return;
         }
@@ -901,10 +897,6 @@ class Session implements \Serializable
             'data'    => $data
         );
 
-        if (!is_array($this->dataStore)) {
-            $this->dataStore = array();
-        }
-
         if (!array_key_exists($type, $this->dataStore)) {
             $this->dataStore[$type] = array();
         }
@@ -923,10 +915,6 @@ class Session implements \Serializable
      */
     private function expireData()
     {
-        if (!is_array($this->dataStore)) {
-            return;
-        }
-
         $ct = time();
 
         foreach ($this->dataStore as &$typedData) {
@@ -965,10 +953,6 @@ class Session implements \Serializable
 
         $this->expireData();
 
-        if (!is_array($this->dataStore)) {
-            return null;
-        }
-
         if (!array_key_exists($type, $this->dataStore)) {
             return null;
         }
@@ -997,10 +981,6 @@ class Session implements \Serializable
     {
         assert(is_string($type));
 
-        if (!is_array($this->dataStore)) {
-            return array();
-        }
-
         if (!array_key_exists($type, $this->dataStore)) {
             return array();
         }
-- 
GitLab