style: replace short ternary operator with ?? / explicit ternary to pass WordPress-Core sniff

This commit is contained in:
peptiderepo
2026-04-23 03:38:28 +00:00
parent 9f8c47d752
commit 996bd2fd44
11 changed files with 16 additions and 17 deletions

View File

@@ -138,7 +138,7 @@ class PRAutoBlogger_Content_Analyzer {
gmdate( 'Y-m-d H:i:s', time() - DAY_IN_SECONDS )
),
ARRAY_A
) ?: array();
) ?? array();
}
/**

View File

@@ -51,7 +51,7 @@ class PRAutoBlogger_Content_Generator {
absint( get_option( 'prautoblogger_min_word_count', 800 ) ),
absint( get_option( 'prautoblogger_max_word_count', 2000 ) ),
get_option( 'prautoblogger_niche_description', '' ),
json_decode( get_option( 'prautoblogger_topic_exclusions', '[]' ), true ) ?: array(),
json_decode( get_option( 'prautoblogger_topic_exclusions', '[]' ), true ) ?? array(),
get_option( 'prautoblogger_writing_instructions', '' )
);

View File

@@ -77,7 +77,7 @@ class PRAutoBlogger_Cost_Reporter {
);
$daily = array();
foreach ( ( $results ?: array() ) as $row ) {
foreach ( ( $results ?? array() ) as $row ) {
$daily[ $row['day'] ] = (float) $row['total_cost'];
}
@@ -117,7 +117,7 @@ class PRAutoBlogger_Cost_Reporter {
);
$breakdown = array();
foreach ( ( $results ?: array() ) as $row ) {
foreach ( ( $results ?? array() ) as $row ) {
$breakdown[ $row['stage'] ] = array(
'cost' => (float) $row['total_cost'],
'tokens' => (int) $row['total_tokens'],

View File

@@ -46,7 +46,7 @@ class PRAutoBlogger_Idea_Scorer {
* @return PRAutoBlogger_Article_Idea[] Top-ranked ideas, sorted by score desc.
*/
public function score_and_rank( array $analysis_results, int $target_count ): array {
$exclusions = json_decode( get_option( 'prautoblogger_topic_exclusions', '[]' ), true ) ?: array();
$exclusions = json_decode( get_option( 'prautoblogger_topic_exclusions', '[]' ), true ) ?? array();
$ideas = array();
$excluded_count = 0;
$deduped_count = 0;

View File

@@ -207,7 +207,7 @@ class PRAutoBlogger_Logger {
);
return array(
'rows' => $rows ?: array(),
'rows' => $rows ?? array(),
'total' => $total,
);
}

View File

@@ -233,7 +233,7 @@ class PRAutoBlogger_Source_Collector {
private function get_config_for_source( string $source_type ): array {
if ( 'reddit' === $source_type ) {
return array(
'subreddits' => json_decode( get_option( 'prautoblogger_target_subreddits', '[]' ), true ) ?: array(),
'subreddits' => json_decode( get_option( 'prautoblogger_target_subreddits', '[]' ), true ) ?? array(),
'limit' => 25,
'time_filter' => 'day',
'include_comments' => true,