Skip to content

Commit

Permalink
Use a constant to improve performance
Browse files Browse the repository at this point in the history
  • Loading branch information
aristath committed Feb 28, 2023
1 parent 695784c commit 6904d31
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/wp-includes/class-wp-autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 6904d31

Please sign in to comment.