global $wgProfiler, $wgProfileLimit;
$params = [
- 'class' => 'ProfilerStub',
+ 'class' => ProfilerStub::class,
'sampling' => 1,
'threshold' => $wgProfileLimit,
'output' => [],
}
$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'] ) ) {
abstract public function scopedProfileIn( $section );
/**
- * @param SectionProfileCallback $section
+ * @param SectionProfileCallback &$section
*/
public function scopedProfileOut( SectionProfileCallback &$section = null ) {
$section = null;