From ef621e06eb1bb598b3b6dba4e06e377d9fe1cce0 Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Thu, 12 Feb 2015 12:53:39 -0800 Subject: [PATCH] Make Profiler::$instance private and drop double underscores Nothing calls it anymore outside of the class Change-Id: Icc9ebcd63e440f9bafca29647856d36fc493ff39 --- includes/profiler/Profiler.php | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/includes/profiler/Profiler.php b/includes/profiler/Profiler.php index 9bb2db9948..4b7420699f 100644 --- a/includes/profiler/Profiler.php +++ b/includes/profiler/Profiler.php @@ -48,10 +48,8 @@ abstract class Profiler { 'udp' => 'ProfilerOutputUdp', ); - // @codingStandardsIgnoreStart PSR2.Classes.PropertyDeclaration.Underscore - /** @var Profiler Do not call this outside Profiler and ProfileSection */ - public static $__instance = null; - // @codingStandardsIgnoreEnd + /** @var Profiler */ + private static $instance = null; /** * @param array $params @@ -69,7 +67,7 @@ abstract class Profiler { * @return Profiler */ final public static function instance() { - if ( self::$__instance === null ) { + if ( self::$instance === null ) { global $wgProfiler; if ( is_array( $wgProfiler ) ) { $class = isset( $wgProfiler['class'] ) ? $wgProfiler['class'] : 'ProfilerStub'; @@ -77,12 +75,12 @@ abstract class Profiler { if ( PHP_SAPI === 'cli' || mt_rand( 0, $factor - 1 ) != 0 ) { $class = 'ProfilerStub'; } - self::$__instance = new $class( $wgProfiler ); + self::$instance = new $class( $wgProfiler ); } else { - self::$__instance = new ProfilerStub( array() ); + self::$instance = new ProfilerStub( array() ); } } - return self::$__instance; + return self::$instance; } /** @@ -93,10 +91,10 @@ abstract class Profiler { * @since 1.25 */ final public static function replaceStubInstance( Profiler $profiler ) { - if ( self::$__instance && !( self::$__instance instanceof ProfilerStub ) ) { + if ( self::$instance && !( self::$instance instanceof ProfilerStub ) ) { throw new MWException( 'Could not replace non-stub profiler instance.' ); } else { - self::$__instance = $profiler; + self::$instance = $profiler; } } -- 2.20.1