From a0f10b0742a11170b080f95b9c2910340ad2bbcd Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sat, 16 Mar 2024 13:18:15 +0000 Subject: [PATCH] Coding Standards: Use strict comparison in `wp-includes/class-wp-theme.php`. Follow-up to [20029], [20119], [20144]. Props aristath, poena, afercia, SergeyBiryukov. See #60700. Built from https://develop.svn.wordpress.org/trunk@57847 git-svn-id: http://core.svn.wordpress.org/trunk@57348 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-theme.php | 19 ++++++++++++------- wp-includes/version.php | 2 +- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/wp-includes/class-wp-theme.php b/wp-includes/class-wp-theme.php index e6eeb8ca5d..9833981dfe 100644 --- a/wp-includes/class-wp-theme.php +++ b/wp-includes/class-wp-theme.php @@ -352,7 +352,7 @@ final class WP_Theme implements ArrayAccess { */ $default_theme_slug = array_search( $this->headers['Name'], self::$default_themes, true ); if ( $default_theme_slug ) { - if ( basename( $this->stylesheet ) != $default_theme_slug ) { + if ( basename( $this->stylesheet ) !== $default_theme_slug ) { $this->headers['Name'] .= '/' . $this->stylesheet; } } @@ -417,7 +417,10 @@ final class WP_Theme implements ArrayAccess { } // If we got our data from cache, we can assume that 'template' is pointing to the right place. - if ( ! is_array( $cache ) && $this->template != $this->stylesheet && ! file_exists( $this->theme_root . '/' . $this->template . '/index.php' ) ) { + if ( ! is_array( $cache ) + && $this->template !== $this->stylesheet + && ! file_exists( $this->theme_root . '/' . $this->template . '/index.php' ) + ) { /* * If we're in a directory of themes inside /themes, look for the parent nearby. * wp-content/themes/directory-of-themes/* @@ -425,7 +428,9 @@ final class WP_Theme implements ArrayAccess { $parent_dir = dirname( $this->stylesheet ); $directories = search_theme_directories(); - if ( '.' !== $parent_dir && file_exists( $this->theme_root . '/' . $parent_dir . '/' . $this->template . '/index.php' ) ) { + if ( '.' !== $parent_dir + && file_exists( $this->theme_root . '/' . $parent_dir . '/' . $this->template . '/index.php' ) + ) { $this->template = $parent_dir . '/' . $this->template; } elseif ( $directories && isset( $directories[ $this->template ] ) ) { /* @@ -460,9 +465,9 @@ final class WP_Theme implements ArrayAccess { } // Set the parent, if we're a child theme. - if ( $this->template != $this->stylesheet ) { + if ( $this->template !== $this->stylesheet ) { // If we are a parent, then there is a problem. Only two generations allowed! Cancel things out. - if ( $_child instanceof WP_Theme && $_child->template == $this->stylesheet ) { + if ( $_child instanceof WP_Theme && $_child->template === $this->stylesheet ) { $_child->parent = null; $_child->errors = new WP_Error( 'theme_parent_invalid', @@ -484,7 +489,7 @@ final class WP_Theme implements ArrayAccess { ) ); // The two themes actually reference each other with the Template header. - if ( $_child->stylesheet == $this->template ) { + if ( $_child->stylesheet === $this->template ) { $this->errors = new WP_Error( 'theme_parent_invalid', sprintf( @@ -1714,7 +1719,7 @@ final class WP_Theme implements ArrayAccess { return (array) apply_filters( 'site_allowed_themes', $allowed_themes[ $blog_id ], $blog_id ); } - $current = get_current_blog_id() == $blog_id; + $current = get_current_blog_id() === $blog_id; if ( $current ) { $allowed_themes[ $blog_id ] = get_option( 'allowedthemes' ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 1016092e84..2ecc419828 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.6-alpha-57845'; +$wp_version = '6.6-alpha-57847'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.