Make WordPress Core


Ignore:
Timestamp:
01/25/2024 07:51:12 AM (3 years ago)
Author:
swissspidy
Message:

I18N: Rename WP_Translation_Controller::instance() method to get_instance().

This improves consistency as get_instance() is more commonly used in core.

See #59656.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/l10n/class-wp-translation-controller.php

    r57339 r57350  
    4343
    4444        /**
    45          * Returns the WP_Translation_Controller singleton.
     45         * Container for the main instance of the class.
     46         *
     47         * @since 6.5.0
     48         * @var WP_Translation_Controller|null
     49         */
     50        private static $instance = null;
     51
     52        /**
     53         * Utility method to retrieve the main instance of the class.
     54         *
     55         * The instance will be created if it does not exist yet.
    4656         *
    4757         * @since 6.5.0
     
    4959         * @return WP_Translation_Controller
    5060         */
    51         public static function instance(): WP_Translation_Controller {
    52                 static $instance;
    53 
    54                 if ( ! $instance ) {
    55                         $instance = new self();
    56                 }
    57 
    58                 return $instance;
     61        public static function get_instance(): WP_Translation_Controller {
     62                if ( null === self::$instance ) {
     63                        self::$instance = new self();
     64                }
     65
     66                return self::$instance;
    5967        }
    6068
Note: See TracChangeset for help on using the changeset viewer.