From 1d9d9d508c0b1f053ecb93a36d639d336b2a8eba Mon Sep 17 00:00:00 2001 From: peptiderepo Date: Tue, 16 Jun 2026 16:29:26 +0000 Subject: [PATCH] fix: rename $class param to $class_name + ignore UnfinishedPrepare + ruleset cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - autoloader.php load() + migration-runner.php class_to_file(): rename $class parameter to $class_name to satisfy Universal.NamingConventions.NoReservedKeywordParameterNames.classFound - dosing-repository.php line 81: add phpcs:ignore UnfinishedPrepare on $wpdb->prepare() — {} is a builder-constructed safe value, not an unfinished placeholder - phpcs.xml.dist: remove incorrect rule names (WordPress.WP.ReservedKeyword.class, WordPress.DB.PreparedSQLPlaceholders.ReplacementsFound); fix excluded names to match actual sniff IDs from CI logs Agent-Session: claude-adopt-ci-20260616 --- includes/class-pr-core-autoloader.php | 8 ++++---- includes/migrations/class-pr-core-migration-runner.php | 6 +++--- includes/repositories/class-pr-core-dosing-repository.php | 2 +- phpcs.xml.dist | 8 ++------ 4 files changed, 10 insertions(+), 14 deletions(-) diff --git a/includes/class-pr-core-autoloader.php b/includes/class-pr-core-autoloader.php index 895884c..b548b77 100644 --- a/includes/class-pr-core-autoloader.php +++ b/includes/class-pr-core-autoloader.php @@ -57,16 +57,16 @@ class PR_Core_Autoloader { /** * Autoload callback. Only handles PR_Core_ prefixed classes. * - * @param string $class Fully-qualified class name. + * @param string $class_name Fully-qualified class name. * @return void */ - public static function load( string $class ): void { - if ( 0 !== strpos( $class, 'PR_Core_' ) ) { + public static function load( string $class_name ): void { + if ( 0 !== strpos( $class_name, 'PR_Core_' ) ) { return; } // PR_Core_Foo_Bar => foo-bar => class-pr-core-foo-bar.php. - $suffix = substr( $class, 8 ); // Strip 'PR_Core_'. + $suffix = substr( $class_name, 8 ); // Strip 'PR_Core_'. $filename = 'class-pr-core-' . str_replace( '_', '-', strtolower( $suffix ) ) . '.php'; foreach ( self::$dirs as $dir ) { diff --git a/includes/migrations/class-pr-core-migration-runner.php b/includes/migrations/class-pr-core-migration-runner.php index c327e14..43ac052 100644 --- a/includes/migrations/class-pr-core-migration-runner.php +++ b/includes/migrations/class-pr-core-migration-runner.php @@ -102,11 +102,11 @@ class PR_Core_Migration_Runner { * * PR_Core_Migration_0001_Dosing_Rows => migrations/class-pr-core-migration-0001-dosing-rows.php * - * @param string $class Fully-qualified class name. + * @param string $class_name Fully-qualified class name. * @return string Absolute file path. */ - private function class_to_file( string $class ): string { - $suffix = substr( $class, 8 ); // Strip 'PR_Core_'. + private function class_to_file( string $class_name ): string { + $suffix = substr( $class_name, 8 ); // Strip 'PR_Core_'. $filename = 'class-pr-core-' . str_replace( '_', '-', strtolower( $suffix ) ) . '.php'; return PR_CORE_PLUGIN_DIR . 'includes/migrations/' . $filename; diff --git a/includes/repositories/class-pr-core-dosing-repository.php b/includes/repositories/class-pr-core-dosing-repository.php index 6f79d9b..853fe1e 100644 --- a/includes/repositories/class-pr-core-dosing-repository.php +++ b/includes/repositories/class-pr-core-dosing-repository.php @@ -77,7 +77,7 @@ class PR_Core_Dosing_Repository { // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery $rows = $wpdb->get_results( - $wpdb->prepare( + $wpdb->prepare( // phpcs:ignore WordPress.DB.PreparedSQLPlaceholders.UnfinishedPrepare -- dynamic {$where_sql} is builder-constructed, not a placeholder "SELECT * FROM {$table} WHERE {$where_sql} ORDER BY evidence_strength DESC, study_year DESC", // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared ...$params ), diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 32dd6c4..bd1e377 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -31,15 +31,11 @@ - + - + - - - -