Merge "Migrate Special:Unblock to OOUI"
[lhc/web/wiklou.git] / includes / parser / ParserOptions.php
index 4809917..c7146a1 100644 (file)
@@ -761,7 +761,7 @@ class ParserOptions {
         * is it allowed in the specific case of parsing this page.
         * @see self::getAllowUnsafeRawHtml()
         * @since 1.29
-        * @param bool|null Value to set or null to get current value
+        * @param bool|null $x Value to set or null to get current value
         * @return bool Current value for allowUnsafeRawHtml
         */
        public function setAllowUnsafeRawHtml( $x ) {
@@ -927,7 +927,6 @@ class ParserOptions {
        }
 
        /**
-        * Constructor
         * @warning For interaction with the parser cache, use
         *  WikiPage::makeParserOptions(), ContentHandler::makeParserOptions(), or
         *  ParserOptions::newCanonical() instead.
@@ -1063,11 +1062,13 @@ class ParserOptions {
                                'speculativeRevIdCallback' => null,
                        ];
 
+                       // @codingStandardsIgnoreStart Squiz.WhiteSpace.OperatorSpacing.NoSpaceAfterAmp
                        Hooks::run( 'ParserOptionsRegister', [
                                &self::$defaults,
                                &self::$inCacheKey,
                                &self::$lazyOptions,
                        ] );
+                       // @codingStandardsIgnoreEnd
 
                        ksort( self::$inCacheKey );
                }
@@ -1211,10 +1212,11 @@ class ParserOptions {
         * Returns the full array of options that would have been used by
         * in 1.16.
         * Used to get the old parser cache entries when available.
-        * @todo 1.16 was years ago, can we remove this?
+        * @deprecated since 1.30. You probably want self::allCacheVaryingOptions() instead.
         * @return array
         */
        public static function legacyOptions() {
+               wfDeprecated( __METHOD__, '1.30' );
                return [
                        'stubthreshold',
                        'numberheadings',
@@ -1225,6 +1227,20 @@ class ParserOptions {
                ];
        }
 
+       /**
+        * Return all option keys that vary the options hash
+        * @since 1.30
+        * @return string[]
+        */
+       public static function allCacheVaryingOptions() {
+               // Trigger a call to the 'ParserOptionsRegister' hook if it hasn't
+               // already been called.
+               if ( self::$defaults === null ) {
+                       self::getDefaults();
+               }
+               return array_keys( array_filter( self::$inCacheKey ) );
+       }
+
        /**
         * Convert an option to a string value
         * @param mixed $value