From a9654f00c8fbc9934289d761843ddd071025013f Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Fri, 28 Aug 2026 17:20:28 +0000
Subject: [PATCH] =PHPStorm Code Inspection: fixed class reference errors (from getting rid of JVB() and replacing with direct class::getInstance; as well as general code sniffing, etc

---
 inc/managers/OperationQueue.php |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/inc/managers/OperationQueue.php b/inc/managers/OperationQueue.php
index 949e5c6..e4dea6e 100644
--- a/inc/managers/OperationQueue.php
+++ b/inc/managers/OperationQueue.php
@@ -5,6 +5,7 @@
 use WP_Error;
 use WP_REST_Response;
 use WP_REST_Request;
+use wpdb;
 
 if (!defined('ABSPATH')) {
     exit; // Exit if accessed directly
@@ -27,7 +28,7 @@
     protected string $table = BASE.'_operation_queue';
     protected string $metricsTable = BASE.'stats__operation_queue';
     protected int $max_attempts = 3;
-	protected \wpdb $wpdb;
+	protected wpdb $wpdb;
 
     // System load thresholds
     protected array $load_thresholds = [
@@ -59,7 +60,7 @@
     {
 		global $wpdb;
 		$this->wpdb = $wpdb;
-		$this->cache = Cache::for('queue', DAY_IN_SECONDS)->connect('user')->user();
+		$this->cache = Cache::for('queue', 'user',DAY_IN_SECONDS)->user();
         add_action('jvb_process_queue', [ $this, 'checkQueue' ]);
 		add_action('jvb_queue_maintenance', [$this, 'hourlyMaintenance']);
         add_action('jvbEmailDailyMetricsReport', [$this, 'emailDailyMetricsReport']);
@@ -547,7 +548,7 @@
 			];
 
 		} catch (Exception $e) {
-			JVB()->error()->log('queue', $e->getMessage(), $data, 'high');
+			Errors::getInstance()->log('queue', $e->getMessage(), $data, 'high');
 			return new WP_Error('queue_failed', $e->getMessage());
 		}
 	}
@@ -1029,7 +1030,7 @@
                 );
 
                 // Log this as a critical error
-                JVB()->error()->log(
+                Errors::getInstance()->log(
                     '[OperationQueue]:restartStuckOperations',
                     "Operation failed after maximum retries",
                     [
@@ -1057,7 +1058,7 @@
                 );
 
                 // Log the backoff
-                JVB()->error()->log(
+                Errors::getInstance()->log(
                     '[OperationQueue]:restartStuckOperations',
                     "Operation requeued with exponential backoff",
                     [
@@ -1184,7 +1185,7 @@
 			if (!is_array($filterResult) || !isset($filterResult['success'])) {
 				// Log invalid filter response and quit early
 				$invalid_response = is_object($filterResult) ? get_class($filterResult) : gettype($filterResult);
-				JVB()->error()->log(
+				Errors::getInstance()->log(
 					'[OperationQueue]:processOperation',
 					"Invalid filter response format - expected array with 'success' key",
 					[
@@ -1348,7 +1349,7 @@
 
 		} catch (Exception $e) {
 			// Handle exception...
-			JVB()->error()->log(
+			Errors::getInstance()->log(
 				'[OperationQueue]:processOperation',
 				"Exception during operation processing: " . $e->getMessage(),
 				[
@@ -1887,7 +1888,7 @@
 
             return $value;
         } catch (Exception $e) {
-            JVB()->error()->log(
+            Errors::getInstance()->log(
                 '[OperationQueue]:getOperationValue',
                 'Error retrieving operation value: ' . $e->getMessage(),
                 [

--
Gitblit v1.10.0