Skip to content

Commit 71a42df

Browse files
committed
Code Quality: Resolve empty.variable PHPStan errors and remove baseline
1 parent e9e15c7 commit 71a42df

3 files changed

Lines changed: 6 additions & 48 deletions

File tree

‎src/wp-includes/class-wp-query.php‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1554,11 +1554,9 @@ protected function parse_search( &$query_vars ) {
15541554
$searchand = ' AND ';
15551555
}
15561556

1557-
if ( ! empty( $search ) ) {
1558-
$search = " AND ({$search}) ";
1559-
if ( ! is_user_logged_in() ) {
1560-
$search .= " AND ({$wpdb->posts}.post_password = '') ";
1561-
}
1557+
$search = " AND ({$search}) ";
1558+
if ( ! is_user_logged_in() ) {
1559+
$search .= " AND ({$wpdb->posts}.post_password = '') ";
15621560
}
15631561

15641562
return $search;
@@ -2784,9 +2782,7 @@ public function get_posts() {
27842782
$status_type_clauses[] = $type_where;
27852783
}
27862784

2787-
if ( ! empty( $status_type_clauses ) ) {
2788-
$where .= ' AND (' . implode( ' OR ', $status_type_clauses ) . ')';
2789-
}
2785+
$where .= ' AND (' . implode( ' OR ', $status_type_clauses ) . ')';
27902786
} else {
27912787
$where .= ' AND 1=0 ';
27922788
}

‎src/wp-includes/taxonomy.php‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3290,7 +3290,7 @@ function wp_unique_term_slug( $slug, $term ) {
32903290
$parent_suffix = '';
32913291
if ( $needs_suffix && is_taxonomy_hierarchical( $term->taxonomy ) && ! empty( $term->parent ) ) {
32923292
$the_parent = $term->parent;
3293-
while ( ! empty( $the_parent ) ) {
3293+
do {
32943294
$parent_term = get_term( $the_parent, $term->taxonomy );
32953295
if ( is_wp_error( $parent_term ) || empty( $parent_term ) ) {
32963296
break;
@@ -3300,11 +3300,8 @@ function wp_unique_term_slug( $slug, $term ) {
33003300
break;
33013301
}
33023302

3303-
if ( empty( $parent_term->parent ) ) {
3304-
break;
3305-
}
33063303
$the_parent = $parent_term->parent;
3307-
}
3304+
} while ( ! empty( $the_parent ) );
33083305
}
33093306

33103307
// If we didn't get a unique slug, try appending a number to make it unique.

‎tests/phpstan/baselines/empty.variable.neon‎

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)