From 7217c154bbe238e9319520f574ba3858f1e57f8e Mon Sep 17 00:00:00 2001 From: peptiderepo Date: Tue, 16 Jun 2026 14:04:40 +0000 Subject: [PATCH] fix: resolve pre-existing PHPCS violations (Yoda conditions + short ternaries) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes non-auto-fixable PHPCS errors surfaced by the estate reusable CI: - scripts/check-constants.php: Yoda conditions at lines 140, 201 - templates/admin/ideas-browser.php: Elvis (?:) → explicit ternary (line 75) - templates/admin/review-queue.php: Elvis (?:) → explicit ternaries (lines 144, 161-163) - templates/admin/metabox-generation-info.php: Elvis (?:) → explicit ternaries (7 lines) - .github/mu-plugins/prautoblogger-deploy-receiver.php: phpcs:ignore for ZipArchive->numFiles (native PHP property, can't be snake_cased); Elvis (?:) fix All violations were pre-existing; none introduced by this PR. Agent-Session: claude/adopt-ci-20260616 --- .../mu-plugins/prautoblogger-deploy-receiver.php | 4 ++-- scripts/check-constants.php | 4 ++-- templates/admin/ideas-browser.php | 3 ++- templates/admin/metabox-generation-info.php | 14 +++++++------- templates/admin/review-queue.php | 8 ++++---- 5 files changed, 17 insertions(+), 16 deletions(-) diff --git a/.github/mu-plugins/prautoblogger-deploy-receiver.php b/.github/mu-plugins/prautoblogger-deploy-receiver.php index 48475f0..0ba4f83 100644 --- a/.github/mu-plugins/prautoblogger-deploy-receiver.php +++ b/.github/mu-plugins/prautoblogger-deploy-receiver.php @@ -108,7 +108,7 @@ function prautoblogger_deploy_handle( WP_REST_Request $request ): WP_REST_Respon } $has_main_file = false; - for ( $i = 0; $i < $zip->numFiles; $i++ ) { + for ( $i = 0; $i < $zip->numFiles; $i++ ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase if ( 'prautoblogger/prautoblogger.php' === $zip->getNameIndex( $i ) ) { $has_main_file = true; break; @@ -200,7 +200,7 @@ function prautoblogger_deploy_handle( WP_REST_Request $request ): WP_REST_Respon sprintf( '[PRAutoBlogger Deploy] Successfully deployed v%s (was: %s) at %s', $incoming_version, - $old_version ?: 'fresh install', + $old_version ? $old_version : 'fresh install', gmdate( 'Y-m-d H:i:s' ) ) ); diff --git a/scripts/check-constants.php b/scripts/check-constants.php index 1b83efd..60a9e87 100644 --- a/scripts/check-constants.php +++ b/scripts/check-constants.php @@ -137,7 +137,7 @@ $errors = array(); foreach ( $php_files as $php_path ) { $raw = file_get_contents( $php_path ); - if ( $raw === false ) { + if ( false === $raw ) { fwrite( STDERR, "WARNING: cannot read {$php_path} -- skipping\n" ); continue; } @@ -198,7 +198,7 @@ foreach ( $php_files as $php_path ) { // 4. Report results. // ------------------------------------------------------------------------- -if ( $errors !== array() ) { +if ( array() !== $errors ) { fwrite( STDERR, "\nFAIL -- Unguarded undefined PRAUTOBLOGGER_* constants:\n\n" ); foreach ( $errors as [ $php_path, $lineno, $name, $line_text ] ) { fwrite( STDERR, " {$php_path}:{$lineno}: {$name}\n" ); diff --git a/templates/admin/ideas-browser.php b/templates/admin/ideas-browser.php index a04efac..27d4a71 100644 --- a/templates/admin/ideas-browser.php +++ b/templates/admin/ideas-browser.php @@ -72,7 +72,8 @@ $base_url = admin_url( 'admin.php?page=prautoblogger-ideas' );

- +

- +

- +

- +

@@ -47,8 +47,8 @@ $meta = array(

- - + +

@@ -69,7 +69,7 @@ $meta = array(

- +

diff --git a/templates/admin/review-queue.php b/templates/admin/review-queue.php index 287a80c..dad6f6d 100644 --- a/templates/admin/review-queue.php +++ b/templates/admin/review-queue.php @@ -141,7 +141,7 @@ $bulk_type = isset( $_GET['prautoblogger_bulk_type'] ) ? sanitize_text_field( wp $quality_score = get_post_meta( $post_id, '_prautoblogger_quality_score', true ); $generated_at = get_post_meta( $post_id, '_prautoblogger_generated_at', true ); $editor_notes = get_post_meta( $post_id, '_prautoblogger_editor_notes', true ); - $verdict_class = 'prautoblogger-verdict-' . sanitize_html_class( $verdict ?: 'pending' ); + $verdict_class = 'prautoblogger-verdict-' . sanitize_html_class( $verdict ? $verdict : 'pending' ); ?> @@ -158,9 +158,9 @@ $bulk_type = isset( $_GET['prautoblogger_bulk_type'] ) ? sanitize_text_field( wp
- - - + + +