From 75524242cbc7d54bc342772a1251773a75542f0c Mon Sep 17 00:00:00 2001
From: Steve Boyd <emteknetnz@gmail.com>
Date: Fri, 14 Jun 2024 21:48:37 +1200
Subject: [PATCH] ENH Use class name instead of self

---
 src/FormFields/SessionManagerField.php    |  2 +-
 src/Jobs/GarbageCollectionJob.php         |  4 ++--
 src/Models/LoginSession.php               |  2 +-
 src/Services/GarbageCollectionService.php |  2 +-
 tests/php/Extensions/ForcePermission.php  | 16 ++++++++--------
 5 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/FormFields/SessionManagerField.php b/src/FormFields/SessionManagerField.php
index be48bd7..f45eb60 100644
--- a/src/FormFields/SessionManagerField.php
+++ b/src/FormFields/SessionManagerField.php
@@ -89,7 +89,7 @@ public function setTitleLinkHref(string $titleLinkHref)
 
     public function Field($properties = array())
     {
-        return $this->renderWith(self::class);
+        return $this->renderWith(SessionManagerField::class);
     }
 
     /**
diff --git a/src/Jobs/GarbageCollectionJob.php b/src/Jobs/GarbageCollectionJob.php
index 130aa56..49526e9 100644
--- a/src/Jobs/GarbageCollectionJob.php
+++ b/src/Jobs/GarbageCollectionJob.php
@@ -61,9 +61,9 @@ public function requireDefaultJob(): void
 
     private function queueNextJob(): void
     {
-        $timestamp = time() + self::config()->get('seconds_between_jobs');
+        $timestamp = time() + static::config()->get('seconds_between_jobs');
         QueuedJobService::singleton()->queueJob(
-            Injector::inst()->create(self::class),
+            Injector::inst()->create(GarbageCollectionJob::class),
             DBDatetime::create()->setValue($timestamp)->Rfc2822()
         );
     }
diff --git a/src/Models/LoginSession.php b/src/Models/LoginSession.php
index 3900823..39038d5 100644
--- a/src/Models/LoginSession.php
+++ b/src/Models/LoginSession.php
@@ -256,7 +256,7 @@ public function getFriendlyUserAgent(): string
      * @param HTTPRequest|null $request
      * @return LoginSession|null
      */
-    public static function getCurrentLoginSession(?HTTPRequest $request = null): ?self
+    public static function getCurrentLoginSession(?HTTPRequest $request = null): ?LoginSession
     {
         // Fall back to retrieving request from current Controller if available
         if ($request === null) {
diff --git a/src/Services/GarbageCollectionService.php b/src/Services/GarbageCollectionService.php
index 53c7d1e..8a3ea30 100644
--- a/src/Services/GarbageCollectionService.php
+++ b/src/Services/GarbageCollectionService.php
@@ -31,7 +31,7 @@ public function collect(): void
 
     private function batchRemoveAll($datalist)
     {
-        $limit = self::config()->get('batch_remove_limit');
+        $limit = static::config()->get('batch_remove_limit');
         $limitedList = $datalist->limit($limit);
         DB::get_conn()->transactionStart();
         foreach ($limitedList as $record) {
diff --git a/tests/php/Extensions/ForcePermission.php b/tests/php/Extensions/ForcePermission.php
index 13a4e07..01e6cdf 100644
--- a/tests/php/Extensions/ForcePermission.php
+++ b/tests/php/Extensions/ForcePermission.php
@@ -16,31 +16,31 @@ class ForcePermission extends DataExtension implements TestOnly
 
     public static function forceCanView($val)
     {
-        self::$canView = $val;
+        ForcePermission::$canView = $val;
     }
 
     public static function forceCanDelete($val)
     {
-        self::$canDelete = $val;
+        ForcePermission::$canDelete = $val;
     }
 
     public static function reset()
     {
-        self::$canView = null;
-        self::$canDelete = null;
+        ForcePermission::$canView = null;
+        ForcePermission::$canDelete = null;
     }
 
     public function canView($member)
     {
-        if (self::$canView !== null) {
-            return self::$canView;
+        if (ForcePermission::$canView !== null) {
+            return ForcePermission::$canView;
         }
     }
 
     public function canDelete($member)
     {
-        if (self::$canDelete !== null) {
-            return self::$canDelete;
+        if (ForcePermission::$canDelete !== null) {
+            return ForcePermission::$canDelete;
         }
     }
 }