From c489ed3424ac287166d97e02b3a55dcdbbc567a2 Mon Sep 17 00:00:00 2001
From: peptiderepo
Date: Mon, 15 Jun 2026 09:23:21 +0000
Subject: [PATCH] Fix CI: PHP 8.1 compat + WPCS violations in v0.3.0 new files
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
PHP 8.1: Cannot use positional argument after argument unpacking —
class-prv-call-log-query.php line 77 (LIMIT/OFFSET args merged into
array before spread).
WPCS fixes across 8 files:
- class-prv-admin-page-css.php: short description capital letter
- class-prv-admin-page.php: docblock started on same line as closing brace
- class-prv-call-drawer-renderer.php: param spacing, empty elseif blocks,
extra indent on render_inline_script
- class-prv-call-log-query.php: InterpolatedNotPrepared (use
phpcs:disable/enable block for WHERE-clause interpolation)
- class-prv-cost-rollup-query.php: InterpolatedNotPrepared for GROUP BY
with dynamic column (phpcs:disable/enable block)
- class-prv-costs-renderer.php: AssociativeArrayFound on inline sub-arrays
- class-prv-probe-run-executor.php: docblock spacing, empty catch blocks,
inline array items, ArrayItemNoNewLine (phpcs:disable on write_meta calls)
- class-prv-probe-runner.php: extra space before ?? operator
---
includes/core/class-prv-admin-page-css.php | 2 +-
includes/core/class-prv-admin-page.php | 4 +-
.../core/class-prv-call-drawer-renderer.php | 12 +-
includes/core/class-prv-call-log-query.php | 15 +-
includes/core/class-prv-cost-rollup-query.php | 4 +-
includes/core/class-prv-costs-renderer.php | 28 +++-
.../core/class-prv-probe-run-executor.php | 146 +++++++++---------
includes/core/class-prv-probe-runner.php | 2 +-
8 files changed, 115 insertions(+), 98 deletions(-)
diff --git a/includes/core/class-prv-admin-page-css.php b/includes/core/class-prv-admin-page-css.php
index fdf80a5..aceb0e3 100644
--- a/includes/core/class-prv-admin-page-css.php
+++ b/includes/core/class-prv-admin-page-css.php
@@ -109,7 +109,7 @@ class PRV_Admin_Page_Css {
}
/**
- * v0.3.0 additions: subnav, costs, call-log, drawer components.
+ * V0.3.0 additions: subnav, costs, call-log, drawer components.
*
* @return string
*/
diff --git a/includes/core/class-prv-admin-page.php b/includes/core/class-prv-admin-page.php
index 3115535..f752368 100644
--- a/includes/core/class-prv-admin-page.php
+++ b/includes/core/class-prv-admin-page.php
@@ -198,7 +198,9 @@ class PRV_Admin_Page {
)
);
echo '
';
- } /**
+ }
+
+ /**
* Return the combined CSS string for all PR Vision admin screens.
*
* Delegates to PRV_Admin_Page_Css to keep this class under 300 lines.
diff --git a/includes/core/class-prv-call-drawer-renderer.php b/includes/core/class-prv-call-drawer-renderer.php
index c8d822c..8431ac4 100644
--- a/includes/core/class-prv-call-drawer-renderer.php
+++ b/includes/core/class-prv-call-drawer-renderer.php
@@ -67,7 +67,7 @@ class PRV_Call_Drawer_Renderer {
*
* Side effects: Outputs HTML.
*
- * @param array $meta Call metadata row.
+ * @param array $meta Call metadata row.
* @param array|null $io I/O record or null (pruned/missing).
*
* @return void
@@ -198,13 +198,9 @@ class PRV_Call_Drawer_Renderer {
)
);
echo '';
- } elseif ( $is_legacy ) {
- // Already shown in prompt section; no duplicate.
- } elseif ( $is_pruned ) {
- // Already shown.
- } elseif ( $has_io && isset( $io['response_text'] ) && '' !== $io['response_text'] ) {
+ } elseif ( ! $is_legacy && ! $is_pruned && $has_io && isset( $io['response_text'] ) && '' !== $io['response_text'] ) {
echo '' . esc_html( $io['response_text'] ) . '
';
- } else {
+ } elseif ( ! $is_error && ! $is_legacy && ! $is_pruned ) {
echo '—
';
}
echo '';
@@ -263,7 +259,7 @@ class PRV_Call_Drawer_Renderer {
*
* @return void
*/
- private function render_inline_script(): void {
+ private function render_inline_script(): void {
PRV_Call_Drawer_Script::render(
wp_create_nonce( PRV_Call_Detail_Ajax::NONCE_ACTION ),
admin_url( 'admin-ajax.php' )
diff --git a/includes/core/class-prv-call-log-query.php b/includes/core/class-prv-call-log-query.php
index 74cf58d..9fb472c 100644
--- a/includes/core/class-prv-call-log-query.php
+++ b/includes/core/class-prv-call-log-query.php
@@ -51,22 +51,24 @@ class PRV_Call_Log_Query {
list( $where_sql, $where_args ) = $this->build_where( $filters );
// Count query.
- // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
+ // phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
$total = (int) $wpdb->get_var(
$wpdb->prepare(
- // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
"SELECT COUNT(*) FROM {$table} {$where_sql}",
...$where_args
)
);
+ // phpcs:enable
$pages = $total > 0 ? (int) ceil( $total / self::PAGE_SIZE ) : 1;
// Data query.
- // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
+ $data_args = $where_args;
+ $data_args[] = self::PAGE_SIZE;
+ $data_args[] = $offset;
+ // phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
$rows = $wpdb->get_results(
$wpdb->prepare(
- // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
"SELECT id, visibility_row, run_id, peptide_slug, model, intent_label,
tokens_in, tokens_out, cost_usd, latency_ms, cited,
http_status, captured_at, config_version
@@ -74,12 +76,11 @@ class PRV_Call_Log_Query {
{$where_sql}
ORDER BY captured_at DESC
LIMIT %d OFFSET %d",
- ...$where_args,
- self::PAGE_SIZE,
- $offset
+ ...$data_args
),
ARRAY_A
);
+ // phpcs:enable
return array(
'rows' => is_array( $rows ) ? $rows : array(),
diff --git a/includes/core/class-prv-cost-rollup-query.php b/includes/core/class-prv-cost-rollup-query.php
index e979241..220c982 100644
--- a/includes/core/class-prv-cost-rollup-query.php
+++ b/includes/core/class-prv-cost-rollup-query.php
@@ -148,10 +148,9 @@ class PRV_Cost_Rollup_Query {
$group_col = 'run_id';
}
- // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
+ // phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
$rows = $wpdb->get_results(
$wpdb->prepare(
- // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
"SELECT {$group_col} AS group_key,
COUNT(*) AS calls,
COALESCE(SUM(cost_usd),0) AS total_cost,
@@ -169,6 +168,7 @@ class PRV_Cost_Rollup_Query {
),
ARRAY_A
);
+ // phpcs:enable
$result = array();
foreach ( (array) $rows as $row ) {
diff --git a/includes/core/class-prv-costs-renderer.php b/includes/core/class-prv-costs-renderer.php
index 099f124..8bde12a 100644
--- a/includes/core/class-prv-costs-renderer.php
+++ b/includes/core/class-prv-costs-renderer.php
@@ -120,10 +120,22 @@ class PRV_Costs_Renderer {
*/
public function render_subnav( string $active ): void {
$tabs = array(
- 'dashboard' => array( 'label' => __( 'Dashboard', 'pr-vision' ), 'slug' => 'pr-vision' ),
- 'costs' => array( 'label' => __( 'Costs', 'pr-vision' ), 'slug' => 'pr-vision-costs' ),
- 'calls' => array( 'label' => __( 'Call Log', 'pr-vision' ), 'slug' => 'pr-vision-calls' ),
- 'settings' => array( 'label' => __( 'Settings', 'pr-vision' ), 'slug' => 'pr-vision-settings' ),
+ 'dashboard' => array(
+ 'label' => __( 'Dashboard', 'pr-vision' ),
+ 'slug' => 'pr-vision',
+ ),
+ 'costs' => array(
+ 'label' => __( 'Costs', 'pr-vision' ),
+ 'slug' => 'pr-vision-costs',
+ ),
+ 'calls' => array(
+ 'label' => __( 'Call Log', 'pr-vision' ),
+ 'slug' => 'pr-vision-calls',
+ ),
+ 'settings' => array(
+ 'label' => __( 'Settings', 'pr-vision' ),
+ 'slug' => 'pr-vision-settings',
+ ),
);
echo '