From 252a2c1f182653e3f3944eda0bbdbf49c0d72470 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 11 Jul 2023 11:32:15 +0000 Subject: [PATCH] Coding Standards: Use strict comparison in `wp-includes/class-wp-rewrite.php`. Follow-up to [3638], [13689], [19743]. Props aristath, poena, afercia, SergeyBiryukov. See #57839. git-svn-id: https://develop.svn.wordpress.org/trunk@56210 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/class-wp-rewrite.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/wp-includes/class-wp-rewrite.php b/src/wp-includes/class-wp-rewrite.php index 7580df0e24..1f25b03ada 100644 --- a/src/wp-includes/class-wp-rewrite.php +++ b/src/wp-includes/class-wp-rewrite.php @@ -1668,7 +1668,7 @@ class WP_Rewrite { $index = ! str_contains( $query, '?' ) ? strlen( $query ) : strpos( $query, '?' ); $front = substr( $query, 0, $index ); - $external = $front != $this->index; + $external = $front !== $this->index; } // "external" = it doesn't correspond to index.php. @@ -1799,7 +1799,8 @@ class WP_Rewrite { if ( ! is_array( $args ) ) { $args = array( 'with_front' => $args ); } - if ( func_num_args() == 4 ) { + + if ( func_num_args() === 4 ) { $args['ep_mask'] = func_get_arg( 3 ); } @@ -1812,14 +1813,16 @@ class WP_Rewrite { 'walk_dirs' => true, 'endpoints' => true, ); - $args = array_intersect_key( $args, $defaults ); - $args = wp_parse_args( $args, $defaults ); + + $args = array_intersect_key( $args, $defaults ); + $args = wp_parse_args( $args, $defaults ); if ( $args['with_front'] ) { $struct = $this->front . $struct; } else { $struct = $this->root . $struct; } + $args['struct'] = $struct; $this->extra_permastructs[ $name ] = $args; @@ -1937,7 +1940,7 @@ class WP_Rewrite { * @param string $permalink_structure Permalink structure. */ public function set_permalink_structure( $permalink_structure ) { - if ( $permalink_structure != $this->permalink_structure ) { + if ( $this->permalink_structure !== $permalink_structure ) { $old_permalink_structure = $this->permalink_structure; update_option( 'permalink_structure', $permalink_structure );