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/meta/Form.php | 25 ++++++++++++++-----------
1 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/inc/meta/Form.php b/inc/meta/Form.php
index a553b32..638bcc1 100644
--- a/inc/meta/Form.php
+++ b/inc/meta/Form.php
@@ -850,15 +850,11 @@
public static function renderExistingAttachment(int $attachmentId, string $subtype):string
{
- switch ($subtype){
- case 'video':
- return static::renderVideoPreview($attachmentId);
- case 'document':
- case 'file':
- return static::renderFilePreview($attachmentId);
- default:
- return static::renderImagePreview($attachmentId);
- }
+ return match ($subtype) {
+ 'video' => static::renderVideoPreview($attachmentId),
+ 'document', 'file' => static::renderFilePreview($attachmentId),
+ default => static::renderImagePreview($attachmentId),
+ };
}
protected static function renderUploadItemStart(?int $attachmentId = null):string
{
@@ -1034,7 +1030,7 @@
}
public static function renderImagePreview(?int $ID = null, ?array $additionalFields = null, bool $isTemplate = false):string
{
- $out = static::renderUploadItemStart($ID, $isTemplate);
+ $out = static::renderUploadItemStart($ID);
//add image preview
if ($ID) {
$out .= jvbFormatImage($ID, 'tiny', 'medium');
@@ -1382,8 +1378,15 @@
$plural
);
break;
+ default:
+ $attr = false;
+ $single = false;
+ $plural = false;
}
+ if (!$attr || !$single || !$plural) {
+ return '';
+ }
$dataAttrs = [];
if ($config['update']) {
$dataAttrs[] = 'data-update="false"';
@@ -1634,7 +1637,7 @@
$values = array_filter(array_values($values));
return implode(', ', $values) ?: 'New Item';
default:
- if (strpos($tagFormat, '{') !== false) {
+ if (str_contains($tagFormat, '{')) {
$text = $tagFormat;
foreach ($values as $key => $value) {
$text = str_replace('{'.$key.'}', $value, $text);
--
Gitblit v1.10.0