Make WordPress Core

Changeset 64236


Ignore:
Timestamp:
10/07/2026 09:36:26 PM (2 weeks ago)
Author:
SergeyBiryukov
Message:

Code Quality: Remove a no-op assignment of $addl_path in redirect_canonical().

$addl_path is initialized to an empty string, and the feed branch then sets it to itself with a trailing slash if it is not empty. Since it is always empty at that point, the assignment always results in an empty string and is removed. There is no change in behavior.

This resolves one error in the empty.variable PHPStan baseline.

Developed in ​https://github.com/WordPress/wordpress-develop/pull/14007.

Follow-up to r9697, r9883.

Props Soean.
See #65817.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/canonical.php

    r64073 r64236  
    457457
    458458                        if ( is_feed() && in_array( $feed, $wp_rewrite->feeds, true ) ) {
    459                                 $addl_path = ! empty( $addl_path ) ? trailingslashit( $addl_path ) : '';
    460 
    461459                                if ( ! is_singular() && get_query_var( 'withcomments' ) ) {
    462460                                        $addl_path .= 'comments/';
  • trunk/tests/phpstan/baselines/empty.variable.neon

    r63510 r64236  
    3030                        path: ../../../src/wp-admin/themes.php
    3131                -
    32                         message: '#^Variable \$addl_path in empty\(\) always exists and is always falsy\.$#'
    33                         identifier: empty.variable
    34                         count: 1
    35                         path: ../../../src/wp-includes/canonical.php
    36                 -
    3732                        message: '#^Variable \$search in empty\(\) always exists and is not falsy\.$#'
    3833                        identifier: empty.variable
Note: See TracChangeset for help on using the changeset viewer.