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.
Built from https://develop.svn.wordpress.org/trunk@56210


git-svn-id: http://core.svn.wordpress.org/trunk@55722 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2023-07-11 11:35:23 +00:00
parent 6fc3060a4e
commit 3eec0065e3
2 changed files with 9 additions and 6 deletions

View File

@ -1668,7 +1668,7 @@ class WP_Rewrite {
$index = ! str_contains( $query, '?' ) ? strlen( $query ) : strpos( $query, '?' ); $index = ! str_contains( $query, '?' ) ? strlen( $query ) : strpos( $query, '?' );
$front = substr( $query, 0, $index ); $front = substr( $query, 0, $index );
$external = $front != $this->index; $external = $front !== $this->index;
} }
// "external" = it doesn't correspond to index.php. // "external" = it doesn't correspond to index.php.
@ -1799,7 +1799,8 @@ class WP_Rewrite {
if ( ! is_array( $args ) ) { if ( ! is_array( $args ) ) {
$args = array( 'with_front' => $args ); $args = array( 'with_front' => $args );
} }
if ( func_num_args() == 4 ) {
if ( func_num_args() === 4 ) {
$args['ep_mask'] = func_get_arg( 3 ); $args['ep_mask'] = func_get_arg( 3 );
} }
@ -1812,14 +1813,16 @@ class WP_Rewrite {
'walk_dirs' => true, 'walk_dirs' => true,
'endpoints' => 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'] ) { if ( $args['with_front'] ) {
$struct = $this->front . $struct; $struct = $this->front . $struct;
} else { } else {
$struct = $this->root . $struct; $struct = $this->root . $struct;
} }
$args['struct'] = $struct; $args['struct'] = $struct;
$this->extra_permastructs[ $name ] = $args; $this->extra_permastructs[ $name ] = $args;
@ -1937,7 +1940,7 @@ class WP_Rewrite {
* @param string $permalink_structure Permalink structure. * @param string $permalink_structure Permalink structure.
*/ */
public function set_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; $old_permalink_structure = $this->permalink_structure;
update_option( 'permalink_structure', $permalink_structure ); update_option( 'permalink_structure', $permalink_structure );

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.3-beta3-56209'; $wp_version = '6.3-beta3-56210';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.