Commit 044296052e for wordpress.org
commit 044296052eee2eab28c17788efbb93308b5c8b40
Author: westonruter <westonruter@git.wordpress.org>
Date: Wed Sep 23 02:43:50 2026 +0000
Code Quality: Remove always-true strict comparisons.
PHPStan reports these conditions as always true (`notIdentical.alwaysTrue`), so they are simplified and the matching entries are removed from the PHPStan baseline:
* In `WP_Links_List_Table::prepare_items()`, `$cat_id` is compared with `0` instead of `'all'`. Since r58069 it has always been an integer from `absint()`, so the string comparison could never fail. An empty category was already ignored by `get_bookmarks()`.
* In `wp_get_layout_style()`, the flex layout's `$gap_value` is checked against an empty string instead of `null`, since it is always the string result of `trim()`. The style engine already drops empty declarations, so the CSS output is unchanged.
* In `WP_Rewrite::add_rewrite_tag()` and `WP_Rewrite::remove_rewrite_tag()`, the redundant `null` check is removed, since `array_search()` returns either a key or `false`.
Developed in https://github.com/WordPress/wordpress-develop/pull/13670.
Follow-up to r36217, r54274, r58069, r63023.
Props arshidkv12, westonruter.
See #65817.
Fixes #66155.
Built from https://develop.svn.wordpress.org/trunk@63887
git-svn-id: http://core.svn.wordpress.org/trunk@63059 1a063a9b-81f0-0310-95a4-ce76da25c4cd
diff --git a/wp-admin/includes/class-wp-links-list-table.php b/wp-admin/includes/class-wp-links-list-table.php
index ae1f50175c..6da144bf50 100644
--- a/wp-admin/includes/class-wp-links-list-table.php
+++ b/wp-admin/includes/class-wp-links-list-table.php
@@ -60,7 +60,7 @@ class WP_Links_List_Table extends WP_List_Table {
'hide_empty' => 0,
);
- if ( 'all' !== $cat_id ) {
+ if ( 0 !== $cat_id ) {
$args['category'] = $cat_id;
}
if ( ! empty( $s ) ) {
diff --git a/wp-includes/block-supports/layout.php b/wp-includes/block-supports/layout.php
index b7c0503d3b..dc9dc0768c 100644
--- a/wp-includes/block-supports/layout.php
+++ b/wp-includes/block-supports/layout.php
@@ -780,7 +780,7 @@ function wp_get_layout_style( $selector, $layout, $has_block_gap_support = false
}
$gap_value = trim( $combined_gap_value );
- if ( null !== $gap_value && ! $should_skip_gap_serialization ) {
+ if ( '' !== $gap_value && ! $should_skip_gap_serialization ) {
$layout_styles[] = array(
'selector' => $selector,
'declarations' => array( 'gap' => $gap_value ),
diff --git a/wp-includes/class-wp-rewrite.php b/wp-includes/class-wp-rewrite.php
index a33604d3d0..63d4c57d03 100644
--- a/wp-includes/class-wp-rewrite.php
+++ b/wp-includes/class-wp-rewrite.php
@@ -799,7 +799,7 @@ class WP_Rewrite {
*/
public function add_rewrite_tag( $tag, $regex, $query ) {
$position = array_search( $tag, $this->rewritecode, true );
- if ( false !== $position && null !== $position ) {
+ if ( false !== $position ) {
$this->rewritereplace[ $position ] = $regex;
$this->queryreplace[ $position ] = $query;
} else {
@@ -823,7 +823,7 @@ class WP_Rewrite {
*/
public function remove_rewrite_tag( $tag ) {
$position = array_search( $tag, $this->rewritecode, true );
- if ( false !== $position && null !== $position ) {
+ if ( false !== $position ) {
unset( $this->rewritecode[ $position ] );
unset( $this->rewritereplace[ $position ] );
unset( $this->queryreplace[ $position ] );
diff --git a/wp-includes/version.php b/wp-includes/version.php
index aead9e184d..6f42647529 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '7.2-alpha-63886';
+$wp_version = '7.2-alpha-63887';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.