Fix CI (round 2): renderer docblock alignment + ARRAY_A + delta_html ignore
- Simplify render_bento and render_score_tile @param types in PRV_Dashboard_Renderer from complex aligned generics to plain 'float', 'float|null', 'int', 'array', 'bool', 'string' with uniform per-group alignment — eliminates SpacingAfterParamType errors on lines 31-41 and 192-196. - Add phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped above the echo $delta_html line (output built by build_delta_html which applies esc_html() to all user-controlled values). - Add ARRAY_A / OBJECT / ARRAY_N WP DB constants to tests/bootstrap.php — PRV_Ai_Visibility_Collector::collect() passes ARRAY_A to $wpdb->get_results(); the constant was never defined in bootstrap because existing tests only call run() not collect() directly. The new test-dashboard-panel.php test calls collect() and hit the undefined constant fatal.
This commit is contained in:
@@ -32,7 +32,7 @@ class PRV_Dashboard_Renderer {
|
|||||||
* @param float|null $prev_score Previous-run score, null if first run.
|
* @param float|null $prev_score Previous-run score, null if first run.
|
||||||
* @param int $cited_count Number of cited peptides.
|
* @param int $cited_count Number of cited peptides.
|
||||||
* @param int $total_count Total peptides tracked.
|
* @param int $total_count Total peptides tracked.
|
||||||
* @param array{state: string, label: string} $health Run-health pill state + label.
|
* @param array $health Run-health pill state + label ({state, label}).
|
||||||
* @param float $mtd_cost Month-to-date spend USD.
|
* @param float $mtd_cost Month-to-date spend USD.
|
||||||
* @param float $cap Monthly budget cap USD.
|
* @param float $cap Monthly budget cap USD.
|
||||||
* @param float $pct Percentage of cap consumed.
|
* @param float $pct Percentage of cap consumed.
|
||||||
@@ -193,7 +193,7 @@ class PRV_Dashboard_Renderer {
|
|||||||
* @param float|null $prev_score Previous run score, null if first run.
|
* @param float|null $prev_score Previous run score, null if first run.
|
||||||
* @param int $cited Number of cited peptides.
|
* @param int $cited Number of cited peptides.
|
||||||
* @param int $total Total peptides tracked.
|
* @param int $total Total peptides tracked.
|
||||||
* @param array{state: string, label: string} $health Run-health pill state.
|
* @param array $health Run-health pill state ({state, label}).
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
@@ -208,7 +208,8 @@ class PRV_Dashboard_Renderer {
|
|||||||
echo '</span>';
|
echo '</span>';
|
||||||
echo '<div class="prv-tile-label">' . esc_html__( 'Visibility Score', 'pr-vision' ) . '</div>';
|
echo '<div class="prv-tile-label">' . esc_html__( 'Visibility Score', 'pr-vision' ) . '</div>';
|
||||||
echo '<div class="prv-tile-big">' . esc_html( (string) $score_pct ) . '<small>%</small></div>';
|
echo '<div class="prv-tile-big">' . esc_html( (string) $score_pct ) . '<small>%</small></div>';
|
||||||
echo $delta_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped — built by build_delta_html; values escaped inside
|
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- built by build_delta_html; esc_html() applied on all user values inside
|
||||||
|
echo $delta_html;
|
||||||
echo '<div class="prv-tile-sub">' . esc_html(
|
echo '<div class="prv-tile-sub">' . esc_html(
|
||||||
sprintf(
|
sprintf(
|
||||||
/* translators: 1: cited count, 2: total peptide count */
|
/* translators: 1: cited count, 2: total peptide count */
|
||||||
|
|||||||
@@ -16,6 +16,17 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||||||
define( 'ABSPATH', __DIR__ . '/' );
|
define( 'ABSPATH', __DIR__ . '/' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WordPress DB result-format constants.
|
||||||
|
if ( ! defined( 'ARRAY_A' ) ) {
|
||||||
|
define( 'ARRAY_A', 'ARRAY_A' );
|
||||||
|
}
|
||||||
|
if ( ! defined( 'OBJECT' ) ) {
|
||||||
|
define( 'OBJECT', 'OBJECT' );
|
||||||
|
}
|
||||||
|
if ( ! defined( 'ARRAY_N' ) ) {
|
||||||
|
define( 'ARRAY_N', 'ARRAY_N' );
|
||||||
|
}
|
||||||
|
|
||||||
define( 'PRV_VERSION', '0.2.1' );
|
define( 'PRV_VERSION', '0.2.1' );
|
||||||
define( 'PRV_PLUGIN_FILE', __DIR__ . '/../pr-vision.php' );
|
define( 'PRV_PLUGIN_FILE', __DIR__ . '/../pr-vision.php' );
|
||||||
define( 'PRV_PLUGIN_DIR', realpath( __DIR__ . '/..' ) . '/' );
|
define( 'PRV_PLUGIN_DIR', realpath( __DIR__ . '/..' ) . '/' );
|
||||||
|
|||||||
Reference in New Issue
Block a user