Commit 8658308a4e for wordpress.org
commit 8658308a4ea5f586207632f18d0e527cf2a2adaa
Author: westonruter <westonruter@git.wordpress.org>
Date: Tue Sep 8 20:06:50 2026 +0000
Code Quality: Remove redundant boolean sub-expressions.
Each of three conditions re-tests something the surrounding expression has already established, so PHPStan reports the redundant operand as always true:
1. In `wp_render_typography_support()`, `! empty()` already requires the `fitText` attribute to be truthy, so a following truthiness check on the same value can never fail.
2. In `_get_block_templates_files()`, the right operand of an `||` is only evaluated when `! $post_type` was false, so a leading `$post_type &&` there is always true.
3. In `Walker::display_element()`, `$newlevel` is a local variable that is only ever assigned the literal `true`, so the truthiness test adds nothing to the `isset()`.
All three are simplifications with no change in behavior. This resolves two `booleanAnd.rightAlwaysTrue` occurrences and one `booleanAnd.leftAlwaysTrue` occurrence, and the corresponding PHPStan baselines are regenerated.
Developed in https://github.com/WordPress/wordpress-develop/pull/13086.
Follow-up to r55687, r61246, r63023.
Props tstokes8040.
See #65817.
Built from https://develop.svn.wordpress.org/trunk@63542
git-svn-id: http://core.svn.wordpress.org/trunk@62718 1a063a9b-81f0-0310-95a4-ce76da25c4cd
diff --git a/wp-includes/block-supports/typography.php b/wp-includes/block-supports/typography.php
index e99d0254fb..3e920f6b3d 100644
--- a/wp-includes/block-supports/typography.php
+++ b/wp-includes/block-supports/typography.php
@@ -304,7 +304,7 @@ function wp_typography_get_preset_inline_style_value( $style_value, $css_propert
* @return string Filtered block content.
*/
function wp_render_typography_support( $block_content, $block ) {
- if ( ! empty( $block['attrs']['fitText'] ) && $block['attrs']['fitText'] && ! is_admin() ) {
+ if ( ! empty( $block['attrs']['fitText'] ) && ! is_admin() ) {
wp_enqueue_script_module( '@wordpress/block-editor/utils/fit-text-frontend' );
// Add Interactivity API directives for fit text to work with client-side navigation.
diff --git a/wp-includes/block-template-utils.php b/wp-includes/block-template-utils.php
index 4dcba75c6d..fa7a30edae 100644
--- a/wp-includes/block-template-utils.php
+++ b/wp-includes/block-template-utils.php
@@ -459,7 +459,7 @@ function _get_block_templates_files( $template_type, $query = array() ) {
if (
! $post_type ||
- ( $post_type && isset( $candidate['postTypes'] ) && in_array( $post_type, $candidate['postTypes'], true ) )
+ ( isset( $candidate['postTypes'] ) && in_array( $post_type, $candidate['postTypes'], true ) )
) {
$template_files[ $template_slug ] = $candidate;
}
diff --git a/wp-includes/class-wp-walker.php b/wp-includes/class-wp-walker.php
index 7361520cbd..3937d5b89d 100644
--- a/wp-includes/class-wp-walker.php
+++ b/wp-includes/class-wp-walker.php
@@ -164,7 +164,7 @@ class Walker {
unset( $children_elements[ $id ] );
}
- if ( isset( $newlevel ) && $newlevel ) {
+ if ( isset( $newlevel ) ) {
// End the child delimiter.
$this->end_lvl( $output, $depth, ...array_values( $args ) );
}
diff --git a/wp-includes/version.php b/wp-includes/version.php
index fd677c2e65..805a56824b 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '7.2-alpha-63541';
+$wp_version = '7.2-alpha-63542';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.