Merge "Use {{int:}} on MediaWiki:Blockedtext and MediaWiki:Autoblockedtext"
[lhc/web/wiklou.git] / includes / parser / ParserOutput.php
index 19375e0..aa015a6 100644 (file)
@@ -151,12 +151,6 @@ class ParserOutput extends CacheTime {
         */
        public $mSections = [];
 
-       /**
-        * @deprecated since 1.31 Use getText() options.
-        * @var bool $mEditSectionTokens prefix/suffix markers if edit sections were output as tokens.
-        */
-       public $mEditSectionTokens = true;
-
        /**
         * @var array $mProperties Name/value pairs to be cached in the DB.
         */
@@ -172,12 +166,6 @@ class ParserOutput extends CacheTime {
         */
        public $mTimestamp;
 
-       /**
-        * @deprecated since 1.31 Use getText() options.
-        * @var bool $mTOCEnabled Whether TOC should be shown, can't override __NOTOC__.
-        */
-       public $mTOCEnabled = true;
-
        /**
         * @var bool $mEnableOOUI Whether OOUI should be enabled.
         */
@@ -189,7 +177,7 @@ class ParserOutput extends CacheTime {
        private $mIndexPolicy = '';
 
        /**
-        * @var array $mAccessedOptions List of ParserOptions (stored in the keys).
+        * @var true[] $mAccessedOptions List of ParserOptions (stored in the keys).
         */
        private $mAccessedOptions = [];
 
@@ -280,22 +268,9 @@ class ParserOutput extends CacheTime {
         * @return string HTML
         */
        public function getText( $options = [] ) {
-               if ( !array_key_exists( 'allowTOC', $options ) && empty( $this->mTOCEnabled ) ) {
-                       wfDeprecated( 'ParserOutput stateful allowTOC', '1.31' );
-               }
-
-               //  Note that while $this->mEditSectionTokens formerly defaulted to false,
-               //  ParserOptions->getEditSection() defaults to true and Parser copies
-               //  that to us so true makes more sense as the stateless default.
-               if ( !array_key_exists( 'enableSectionEditLinks', $options ) && !$this->mEditSectionTokens ) {
-                       wfDeprecated( 'ParserOutput stateful enableSectionEditLinks', '1.31' );
-               }
-
                $options += [
-                       // empty() here because old cached versions might lack the field somehow.
-                       // In that situation, the historical behavior (possibly buggy) is to remove the TOC.
-                       'allowTOC' => !empty( $this->mTOCEnabled ),
-                       'enableSectionEditLinks' => $this->mEditSectionTokens,
+                       'allowTOC' => true,
+                       'enableSectionEditLinks' => true,
                        'unwrap' => false,
                        'deduplicateStyles' => true,
                ];
@@ -442,7 +417,8 @@ class ParserOutput extends CacheTime {
         * @deprecated since 1.31 Use getText() options.
         */
        public function getEditSectionTokens() {
-               return $this->mEditSectionTokens;
+               wfDeprecated( __METHOD__, '1.31' );
+               return true;
        }
 
        public function &getLinks() {
@@ -532,7 +508,8 @@ class ParserOutput extends CacheTime {
         * @deprecated since 1.31 Use getText() options.
         */
        public function getTOCEnabled() {
-               return $this->mTOCEnabled;
+               wfDeprecated( __METHOD__, '1.31' );
+               return true;
        }
 
        public function getEnableOOUI() {
@@ -563,7 +540,8 @@ class ParserOutput extends CacheTime {
         * @deprecated since 1.31 Use getText() options.
         */
        public function setEditSectionTokens( $t ) {
-               return wfSetVar( $this->mEditSectionTokens, $t );
+               wfDeprecated( __METHOD__, '1.31' );
+               return true;
        }
 
        public function setIndexPolicy( $policy ) {
@@ -582,7 +560,8 @@ class ParserOutput extends CacheTime {
         * @deprecated since 1.31 Use getText() options.
         */
        public function setTOCEnabled( $flag ) {
-               return wfSetVar( $this->mTOCEnabled, $flag );
+               wfDeprecated( __METHOD__, '1.31' );
+               return true;
        }
 
        public function addCategory( $c, $sort ) {
@@ -706,9 +685,8 @@ class ParserOutput extends CacheTime {
        /**
         * Register a file dependency for this output
         * @param string $name Title dbKey
-        * @param string $timestamp MW timestamp of file creation (or false if non-existing)
-        * @param string $sha1 Base 36 SHA-1 of file (or false if non-existing)
-        * @return void
+        * @param string|false|null $timestamp MW timestamp of file creation (or false if non-existing)
+        * @param string|false|null $sha1 Base 36 SHA-1 of file (or false if non-existing)
         */
        public function addImage( $name, $timestamp = null, $sha1 = null ) {
                $this->mImages[$name] = 1;
@@ -722,7 +700,6 @@ class ParserOutput extends CacheTime {
         * @param Title $title
         * @param int $page_id
         * @param int $rev_id
-        * @return void
         */
        public function addTemplate( $title, $page_id, $rev_id ) {
                $ns = $title->getNamespace();
@@ -767,14 +744,24 @@ class ParserOutput extends CacheTime {
                }
        }
 
+       /**
+        * @see OutputPage::addModules
+        */
        public function addModules( $modules ) {
                $this->mModules = array_merge( $this->mModules, (array)$modules );
        }
 
+       /**
+        * @deprecated since 1.31 Use addModules() instead.
+        * @see OutputPage::addModuleScripts
+        */
        public function addModuleScripts( $modules ) {
                $this->mModuleScripts = array_merge( $this->mModuleScripts, (array)$modules );
        }
 
+       /**
+        * @see OutputPage::addModuleStyles
+        */
        public function addModuleStyles( $modules ) {
                $this->mModuleStyles = array_merge( $this->mModuleStyles, (array)$modules );
        }
@@ -989,8 +976,8 @@ class ParserOutput extends CacheTime {
 
        /**
         * Returns the options from its ParserOptions which have been taken
-        * into account to produce this output or false if not available.
-        * @return array
+        * into account to produce this output.
+        * @return string[]
         */
        public function getUsedOptions() {
                if ( !isset( $this->mAccessedOptions ) ) {