Merge "Warn if stateful ParserOutput transforms are used"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 2 Feb 2018 02:45:27 +0000 (02:45 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 2 Feb 2018 02:45:27 +0000 (02:45 +0000)
includes/parser/ParserOutput.php
tests/phpunit/includes/parser/ParserOutputTest.php

index 8f7ed24..e2efaff 100644 (file)
@@ -273,13 +273,16 @@ class ParserOutput extends CacheTime {
         * @return string HTML
         */
        public function getText( $options = [] ) {
-               // @todo Warn if !array_key_exists( 'allowTOC', $options ) && empty( $this->mTOCEnabled )
+               if ( !array_key_exists( 'allowTOC', $options ) && empty( $this->mTOCEnabled ) ) {
+                       wfDeprecated( 'ParserOutput stateful allowTOC', '1.31' );
+               }
 
-               // @todo Warn if !array_key_exists( 'enableSectionEditLinks', $options )
-               //     && !$this->mEditSectionTokens
                //  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.
index 8cc7ba1..efcc4e0 100644 (file)
@@ -105,6 +105,8 @@ class ParserOutputTest extends MediaWikiTestCase {
                        'wgScriptPath' => '/w',
                        'wgScript' => '/w/index.php',
                ] );
+               $this->hideDeprecated( 'ParserOutput stateful allowTOC' );
+               $this->hideDeprecated( 'ParserOutput stateful enableSectionEditLinks' );
 
                $po = new ParserOutput( $text );