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/integrations/services/InstagramOld.php |   29 ++++++++++++-----------------
 1 files changed, 12 insertions(+), 17 deletions(-)

diff --git a/inc/integrations/services/InstagramOld.php b/inc/integrations/services/InstagramOld.php
index 378cb7b..0845040 100644
--- a/inc/integrations/services/InstagramOld.php
+++ b/inc/integrations/services/InstagramOld.php
@@ -5,9 +5,11 @@
  */
 
 namespace JVBase\integrations\services;
+use Exception;
 use JVBase\integrations\Integrations;
 use JVBase\meta\Meta;
 use WP_Error;
+use WP_Post;
 
 if (!defined('ABSPATH')) {
 	exit;
@@ -257,7 +259,7 @@
 	/**
 	 * Handle post save - queue Instagram post creation
 	 */
-	public function handleTheSavePost(int $postID, \WP_Post $post, bool $update, array $settings): void
+	public function handleTheSavePost(int $postID, WP_Post $post, bool $update, array $settings): void
 	{
 
 		if (!$this->hasOAuthCredentials()) {
@@ -280,23 +282,16 @@
 	/**
 	 * Process queued operations
 	 */
-	public function processOperation(\WP_Error|array $result, object $operation, array $data): \WP_Error|array
+	public function processOperation(WP_Error|array $result, object $operation, array $data): WP_Error|array
 	{
 		$base = strtolower($this->service_name) . '_';
 		$insta = (array_key_exists('user', $data)) ? new self((int)$data['user']) : $this;
-		switch ($operation->type) {
-			case $base . 'create_post':
-				return $insta->processCreatePost($data);
-
-			case $base . 'create_story':
-				return $insta->processCreateStory($data);
-
-			case $base . 'delete_post':
-				return $insta->processDeletePost($data);
-
-			default:
-				return $result;
-		}
+		return match ($operation->type) {
+			$base . 'create_post' => $insta->processCreatePost($data),
+			$base . 'create_story' => $insta->processCreateStory($data),
+			$base . 'delete_post' => $insta->processDeletePost($data),
+			default => $result,
+		};
 	}
 
 	private function processDeletePost(array $data): array
@@ -382,7 +377,7 @@
 	/**
 	 * Build caption for Instagram post
 	 */
-	private function buildCaption(\WP_Post $post): string
+	private function buildCaption(WP_Post $post): string
 	{
 		$caption_parts = [];
 
@@ -410,7 +405,7 @@
 				$default = preg_split('/[\s,]+/', $this->post_settings['default_hashtags']);
 				foreach ($default as $tag) {
 					$tag = trim($tag);
-					if (strpos($tag, '#') !== 0) {
+					if (!str_starts_with($tag, '#')) {
 						$tag = '#' . $tag;
 					}
 					$hashtags[] = $tag;

--
Gitblit v1.10.0