Use typed properties in Session class
authorTim Düsterhus <duesterhus@woltlab.com>
Mon, 8 Aug 2022 09:11:52 +0000 (11:11 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Mon, 8 Aug 2022 09:11:52 +0000 (11:11 +0200)
wcfsetup/install/files/lib/system/session/Session.class.php

index a54b51b5c5a02d15c6a58642e1d6aa2d581a2127..89196275e0a8e8c1be0c9f20534621716dec24ee 100644 (file)
@@ -21,10 +21,7 @@ final class Session
      */
     private $data;
 
-    /**
-     * @var UserAgent
-     */
-    private $userAgent;
+    private UserAgent $userAgent;
 
     /**
      * Session constructor.
@@ -90,7 +87,7 @@ final class Session
      */
     public function getUserAgent(): UserAgent
     {
-        if ($this->userAgent === null) {
+        if (!isset($this->userAgent)) {
             $this->userAgent = new UserAgent($this->data['userAgent']);
         }