Merge "Title: Refactor JS/CSS page handling to be more sane"
[lhc/web/wiklou.git] / includes / profiler / Profiler.php
index 252a227..d02011f 100644 (file)
@@ -64,7 +64,7 @@ abstract class Profiler {
                        global $wgProfiler, $wgProfileLimit;
 
                        $params = [
-                               'class'     => 'ProfilerStub',
+                               'class'     => ProfilerStub::class,
                                'sampling'  => 1,
                                'threshold' => $wgProfileLimit,
                                'output'    => [],
@@ -74,8 +74,9 @@ abstract class Profiler {
                        }
 
                        $inSample = mt_rand( 0, $params['sampling'] - 1 ) === 0;
-                       if ( PHP_SAPI === 'cli' || !$inSample ) {
-                               $params['class'] = 'ProfilerStub';
+                       // wfIsCLI() is not available yet
+                       if ( PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg' || !$inSample ) {
+                               $params['class'] = ProfilerStub::class;
                        }
 
                        if ( !is_array( $params['output'] ) ) {
@@ -164,7 +165,7 @@ abstract class Profiler {
        abstract public function scopedProfileIn( $section );
 
        /**
-        * @param SectionProfileCallback $section
+        * @param SectionProfileCallback &$section
         */
        public function scopedProfileOut( SectionProfileCallback &$section = null ) {
                $section = null;
@@ -187,7 +188,7 @@ abstract class Profiler {
         * Get all usable outputs.
         *
         * @throws MWException
-        * @return array Array of ProfilerOutput instances.
+        * @return ProfilerOutput[]
         * @since 1.25
         */
        private function getOutputs() {