Merge "Fix sessionfailure i18n message during authentication"
[lhc/web/wiklou.git] / includes / parser / ParserOptions.php
index ee0da2a..ca8e739 100644 (file)
@@ -65,7 +65,6 @@ class ParserOptions {
                'stubthreshold' => true,
                'printable' => true,
                'userlang' => true,
-               'wrapclass' => true,
        ];
 
        /**
@@ -780,13 +779,17 @@ class ParserOptions {
        /**
         * CSS class to use to wrap output from Parser::parse()
         * @since 1.30
-        * @param string|bool $className Set false to disable wrapping.
+        * @param string $className Class name to use for wrapping.
+        *   Passing false to indicate "no wrapping" was deprecated in MediaWiki 1.31.
         * @return string|bool Current value
         */
        public function setWrapOutputClass( $className ) {
                if ( $className === true ) { // DWIM, they probably want the default class name
                        $className = 'mw-parser-output';
                }
+               if ( $className === false ) {
+                       wfDeprecated( __METHOD__ . '( false )', '1.31' );
+               }
                return $this->setOption( 'wrapclass', $className );
        }
 
@@ -869,6 +872,7 @@ class ParserOptions {
 
        /**
         * Create "edit section" links?
+        * @deprecated since 1.31, use ParserOutput::getText() options instead.
         * @return bool
         */
        public function getEditSection() {
@@ -877,6 +881,7 @@ class ParserOptions {
 
        /**
         * Create "edit section" links?
+        * @deprecated since 1.31, use ParserOutput::getText() options instead.
         * @param bool|null $x New value (null is no change)
         * @return bool Old value
         */
@@ -944,6 +949,9 @@ class ParserOptions {
                }
                if ( $lang === null ) {
                        global $wgLang;
+                       if ( !StubObject::isRealObject( $wgLang ) ) {
+                               $wgLang->_unstub();
+                       }
                        $lang = $wgLang;
                }
                $this->initialiseFromUser( $user, $lang );
@@ -1011,7 +1019,7 @@ class ParserOptions {
         *
         * @since 1.30
         * @param User|null $user
-        * @param Language|null $lang
+        * @param Language|StubObject|null $lang
         * @return ParserOptions
         */
        public static function newCanonical( User $user = null, $lang = null ) {
@@ -1054,18 +1062,16 @@ class ParserOptions {
                                'printable' => false,
                                'allowUnsafeRawHtml' => true,
                                'wrapclass' => 'mw-parser-output',
-                               'currentRevisionCallback' => [ 'Parser', 'statelessFetchRevision' ],
-                               'templateCallback' => [ 'Parser', 'statelessFetchTemplate' ],
+                               'currentRevisionCallback' => [ Parser::class, 'statelessFetchRevision' ],
+                               'templateCallback' => [ Parser::class, 'statelessFetchTemplate' ],
                                'speculativeRevIdCallback' => null,
                        ];
 
-                       // @codingStandardsIgnoreStart Squiz.WhiteSpace.OperatorSpacing.NoSpaceAfterAmp
                        Hooks::run( 'ParserOptionsRegister', [
                                &self::$defaults,
                                &self::$inCacheKey,
                                &self::$lazyOptions,
                        ] );
-                       // @codingStandardsIgnoreEnd
 
                        ksort( self::$inCacheKey );
                }