parser: Fix return type for methods and match phpdoc comments
[lhc/web/wiklou.git] / includes / parser / Preprocessor.php
index 49e961a..bdfedd6 100644 (file)
@@ -22,6 +22,7 @@
  */
 
 use MediaWiki\Logger\LoggerFactory;
+use MediaWiki\MediaWikiServices;
 
 /**
  * @ingroup Parser
@@ -73,10 +74,12 @@ abstract class Preprocessor {
                        return;
                }
 
-               $cache = ObjectCache::getLocalClusterInstance();
+               $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
                $key = $cache->makeKey(
                        defined( 'static::CACHE_PREFIX' ) ? static::CACHE_PREFIX : static::class,
-                       md5( $text ), $flags );
+                       md5( $text ),
+                       $flags
+               );
                $value = sprintf( "%08d", static::CACHE_VERSION ) . $tree;
 
                $cache->set( $key, $value, 86400 );
@@ -102,11 +105,13 @@ abstract class Preprocessor {
                        return false;
                }
 
-               $cache = ObjectCache::getLocalClusterInstance();
+               $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
 
                $key = $cache->makeKey(
                        defined( 'static::CACHE_PREFIX' ) ? static::CACHE_PREFIX : static::class,
-                       md5( $text ), $flags );
+                       md5( $text ),
+                       $flags
+               );
 
                $value = $cache->get( $key );
                if ( !$value ) {
@@ -171,7 +176,8 @@ interface PPFrame {
        const RECOVER_COMMENTS = 16;
        const NO_TAGS = 32;
 
-       const RECOVER_ORIG = 59; // = 1|2|8|16|32 no constant expression support in PHP yet
+       const RECOVER_ORIG = self::NO_ARGS | self::NO_TEMPLATES | self::NO_IGNORE |
+               self::RECOVER_COMMENTS | self::NO_TAGS;
 
        /** This constant exists when $indexOffset is supported in newChild() */
        const SUPPORTS_INDEX_OFFSET = 1;