From 6904d31999955283170959c03c5bf8c2005c6515 Mon Sep 17 00:00:00 2001 From: Ari Stathopoulos Date: Tue, 28 Feb 2023 09:58:46 +0200 Subject: [PATCH] Use a constant to improve performance --- src/wp-includes/class-wp-autoload.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/wp-includes/class-wp-autoload.php b/src/wp-includes/class-wp-autoload.php index 7014da38eab4f..17869f3ce2a08 100644 --- a/src/wp-includes/class-wp-autoload.php +++ b/src/wp-includes/class-wp-autoload.php @@ -21,7 +21,7 @@ final class WP_Autoload { * * @var array */ - private static $classes_paths = array( + const CLASSES_PATHS = array( /* Classes in the wp-includes/ folder. */ 'walker_categorydropdown' => 'wp-includes/class-walker-category-dropdown.php', 'walker_category' => 'wp-includes/class-walker-category.php', @@ -411,11 +411,11 @@ public static function autoload_core( $class_name ) { $class_name = strtolower( $class_name ); // Bail early if the class is not a WP class. - if ( ! isset( static::$classes_paths[ $class_name ] ) ) { + if ( ! isset( static::CLASSES_PATHS[ $class_name ] ) ) { return false; } - require_once ABSPATH . static::$classes_paths[ $class_name ]; + require_once ABSPATH . static::CLASSES_PATHS[ $class_name ]; return true; } }