+ $services = MediaWikiServices::getInstance();
+ if ( !$svcOptions || is_array( $svcOptions ) ) {
+ // Pre-1.34 calling convention is the first parameter is just ParserConf, the seventh is
+ // Config, and the eighth is LinkRendererFactory.
+ $this->mConf = (array)$svcOptions;
+ if ( empty( $this->mConf['class'] ) ) {
+ $this->mConf['class'] = self::class;
+ }
+ if ( empty( $this->mConf['preprocessorClass'] ) ) {
+ $this->mConf['preprocessorClass'] = self::getDefaultPreprocessorClass();
+ }
+ $this->svcOptions = new ServiceOptions( self::$constructorOptions,
+ $this->mConf,
+ func_num_args() > 6 ? func_get_arg( 6 ) : $services->getMainConfig()
+ );
+ $linkRendererFactory = func_num_args() > 7 ? func_get_arg( 7 ) : null;
+ $nsInfo = func_num_args() > 8 ? func_get_arg( 8 ) : null;
+ } else {
+ // New calling convention
+ $svcOptions->assertRequiredOptions( self::$constructorOptions );
+ // $this->mConf is public, so we'll keep those two options there as well for
+ // compatibility until it's removed
+ $this->mConf = [
+ 'class' => $svcOptions->get( 'class' ),
+ 'preprocessorClass' => $svcOptions->get( 'preprocessorClass' ),
+ ];
+ $this->svcOptions = $svcOptions;
+ }
+