X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;ds=sidebyside;f=includes%2Fparser%2FParserOptions.php;h=c7146a13063faa1f2a3e5093d90475e9e95ae69c;hb=52ba4e60846b7c47d7b460beee82654346c41093;hp=4809917b631f9c817c3e79041f63a08ce4d905e7;hpb=d89e006b74ab057868f4bfe7b9e682eb02c538a2;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/parser/ParserOptions.php b/includes/parser/ParserOptions.php index 4809917b63..c7146a1306 100644 --- a/includes/parser/ParserOptions.php +++ b/includes/parser/ParserOptions.php @@ -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