Introduce wfDeprecatedMsg()

Deprecating something means to say something nasty about it, or to draw
its character into question. For example, "this function is lazy and good
for nothing". Deprecatory remarks by a developer are generally taken as a
warning that violence will soon be done against the function in question.
Other developers are thus warned to avoid associating with the deprecated
function.

However, since wfDeprecated() was introduced, it has become obvious that
the targets of deprecation are not limited to functions. Developers can
deprecate literally anything: a parameter, a return value, a file
format, Mondays, the concept of being, etc. wfDeprecated() requires
every deprecatory statement to begin with "use of", leading to some
awkward sentences. For example, one might say: "Use of your mouth to
cough without it being covered by your arm is deprecated since 2020."

So, introduce wfDeprecatedMsg(), which allows deprecation messages to be
specified in plain text, with the caller description being optionally
appended. Migrate incorrect or gramatically awkward uses of wfDeprecated()
to wfDeprecatedMsg().

Change-Id: Ib3dd2fe37677d98425d0f3692db5c9e988943ae8
This commit is contained in:
Tim Starling 2020-06-12 14:18:35 +10:00
parent 447cd98b8c
commit d459add63d
34 changed files with 199 additions and 94 deletions

View file

@ -67,8 +67,9 @@ class FileDeleteForm {
$this->file = $file;
if ( $user === null ) {
wfDeprecated(
__CLASS__ . ' being constructing without a $user parameter',
wfDeprecatedMsg(
'Construction of ' . __CLASS__ . ' without a $user parameter ' .
'was deprecated in MediaWiki 1.35',
'1.35'
);
global $wgUser;

View file

@ -1037,6 +1037,32 @@ function wfDeprecated( $function, $version = false, $component = false, $callerO
}
}
/**
* Log a deprecation warning with arbitrary message text. A caller
* description will be appended. If the message has already been sent for
* this caller, it won't be sent again.
*
* Although there are component and version parameters, they are not
* automatically appended to the message. The message text should include
* information about when the thing was deprecated. The component and version
* are just used to implement $wgDeprecationReleaseLimit.
*
* @since 1.35
*
* @param string $msg The message
* @param string|false $version Version of MediaWiki that the function
* was deprecated in.
* @param string|bool $component Component to which the function belongs.
* If false, it is assumed the function is in MediaWiki core.
* @param int|false $callerOffset How far up the call stack is the original
* caller. 2 = function that called the function that called us. If false,
* the caller description will not be appended.
*/
function wfDeprecatedMsg( $msg, $version = false, $component = false, $callerOffset = 2 ) {
MWDebug::deprecatedMsg( $msg, $version, $component,
$callerOffset === false ? false : $callerOffset + 1 );
}
/**
* Send a warning either to the debug log or in a PHP error depending on
* $wgDevelopmentWarnings. To log warnings in production, use wfLogWarning() instead.

View file

@ -137,9 +137,10 @@ class HookContainer implements SalvageableService {
return false;
}
if ( is_string( $return ) ) {
wfDeprecated(
"returning a string from a hook handler (done by $functionName for $hook)",
'1.35'
wfDeprecatedMsg(
"Returning a string from a hook handler is deprecated since MediaWiki 1.35 ' .
'(done by $functionName for $hook)",
'1.35', false, false
);
throw new UnexpectedValueException( $return );
}

View file

@ -47,8 +47,9 @@ class Hooks {
*/
public static function register( $name, $callback ) {
if ( !defined( 'MW_SERVICE_BOOTSTRAP_COMPLETE' ) ) {
wfDeprecated( 'Registering handler for ' . $name .
' before MediaWiki bootstrap complete', '1.35' );
wfDeprecatedMsg( 'Registering handler for ' . $name .
' before MediaWiki bootstrap complete was deprecated in MediaWiki 1.35',
'1.35' );
}
$hookContainer = MediaWikiServices::getInstance()->getHookContainer();
$hookContainer->register( $name, $callback );

View file

@ -105,7 +105,8 @@ class MergeHistory {
SpamChecker $spamChecker = null
) {
if ( $loadBalancer === null ) {
wfDeprecated( __CLASS__ . ' being constructed directly', '1.35' );
wfDeprecatedMsg( 'Direct construction of ' . __CLASS__ .
' was deprecated in MediaWiki 1.35', '1.35' );
$services = MediaWikiServices::getInstance();
$loadBalancer = $services->getDBLoadBalancer();

View file

@ -2265,7 +2265,9 @@ class OutputPage extends ContextSource {
*/
public function addVaryHeader( $header, array $option = null ) {
if ( $option !== null && count( $option ) > 0 ) {
wfDeprecated( 'addVaryHeader $option is ignored', '1.34' );
wfDeprecatedMsg(
'The $option parameter to addVaryHeader is ignored since MediaWiki 1.34',
'1.34' );
}
if ( !array_key_exists( $header, $this->mVaryHeader ) ) {
$this->mVaryHeader[$header] = null;

View file

@ -2060,9 +2060,9 @@ class Title implements LinkTarget, IDBAccessObject {
*/
private static function fixUrlQueryArgs( $query, $query2 = false ) {
if ( $query2 !== false ) {
wfDeprecated( "Title::get{Canonical,Full,Link,Local,Internal}URL " .
"method called with a second parameter is deprecated. Add your " .
"parameter to an array passed as the first parameter.", "1.19" );
wfDeprecatedMsg( "Title::get{Canonical,Full,Link,Local,Internal}URL " .
"method called with a second parameter is deprecated since MediaWiki 1.19. " .
"Add your parameter to an array passed as the first parameter.", "1.19" );
}
if ( is_array( $query ) ) {
$query = wfArrayToCgi( $query );

View file

@ -68,8 +68,9 @@ class ApiQuerySearch extends ApiQueryGeneratorBase {
$nquery = $search->replacePrefixes( $query );
if ( $nquery !== $query ) {
$query = $nquery;
wfDeprecated( 'SearchEngine::replacePrefixes() (overridden by ' .
get_class( $search ) . ')', '1.32' );
wfDeprecatedMsg( 'SearchEngine::replacePrefixes() is overridden by ' .
get_class( $search ) . ', this was deprecated in MediaWiki 1.32',
'1.32' );
}
// Perform the actual search
if ( $what == 'text' ) {

View file

@ -70,8 +70,9 @@ class CategoryMembershipChange {
public function __construct( Title $pageTitle, $revision = null ) {
$this->pageTitle = $pageTitle;
if ( $revision instanceof Revision ) {
wfDeprecated(
'Revision for ' . __METHOD__,
wfDeprecatedMsg(
'Passing a Revision for the $revision parameter to ' . __METHOD__ .
' was deprecated in MediaWiki 1.35',
'1.35'
);
$revision = $revision->getRevisionRecord();

View file

@ -313,11 +313,12 @@ abstract class MWLBFactory {
$class = $config['class'];
if ( isset( $bcClasses[$class] ) ) {
$class = $bcClasses[$class];
wfDeprecated(
'$wgLBFactoryConf must be updated. See RELEASE-NOTES for details',
wfDeprecatedMsg(
'$wgLBFactoryConf must be updated. ' .
"The class $class was renamed to {$bcClasses[$class]} in MediaWiki 1.23.",
'1.23'
);
$class = $bcClasses[$class];
}
// For configuration backward compatibility after moving classes to namespaces (1.29)

View file

@ -225,15 +225,53 @@ class MWDebug {
public static function deprecated( $function, $version = false,
$component = false, $callerOffset = 2
) {
$callerDescription = self::getCallerDescription( $callerOffset );
$callerFunc = $callerDescription['func'];
if ( $version ) {
$component = $component ?: 'MediaWiki';
$msg = "Use of $function was deprecated in $component $version.";
} else {
$msg = "Use of $function is deprecated.";
}
self::deprecatedMsg( $msg, $version, $component, $callerOffset + 1 );
}
/**
* Log a deprecation warning with arbitrary message text. A caller
* description will be appended. If the message has already been sent for
* this caller, it won't be sent again.
*
* Although there are component and version parameters, they are not
* automatically appended to the message. The message text should include
* information about when the thing was deprecated.
*
* @since 1.35
*
* @param string $msg The message
* @param string|false $version Version of MediaWiki that the function
* was deprecated in.
* @param string|bool $component Component to which the function belongs.
* If false, it is assumed the function is in MediaWiki core.
* @param int|false $callerOffset How far up the call stack is the original
* caller. 2 = function that called the function that called us. If false,
* the caller description will not be appended.
*/
public static function deprecatedMsg( $msg, $version = false,
$component = false, $callerOffset = 2
) {
if ( $callerOffset === false ) {
$callerFunc = '';
$rawMsg = $msg;
} else {
$callerDescription = self::getCallerDescription( $callerOffset );
$callerFunc = $callerDescription['func'];
$rawMsg = self::formatCallerDescription( $msg, $callerDescription );
}
$sendToLog = true;
// Check to see if there already was a warning about this function
if ( isset( self::$deprecationWarnings[$function][$callerFunc] ) ) {
if ( isset( self::$deprecationWarnings[$msg][$callerFunc] ) ) {
return;
} elseif ( isset( self::$deprecationWarnings[$function] ) ) {
} elseif ( isset( self::$deprecationWarnings[$msg] ) ) {
if ( self::$enabled ) {
$sendToLog = false;
} else {
@ -241,7 +279,7 @@ class MWDebug {
}
}
self::$deprecationWarnings[$function][$callerFunc] = true;
self::$deprecationWarnings[$msg][$callerFunc] = true;
if ( $version ) {
global $wgDeprecationReleaseLimit;
@ -257,22 +295,18 @@ class MWDebug {
$sendToLog = false;
}
}
$component = $component ?: 'MediaWiki';
$msg = "Use of $function was deprecated in $component $version.";
} else {
$msg = "Use of $function is deprecated.";
}
self::sendRawDeprecated(
self::formatCallerDescription( $msg, $callerDescription ),
$rawMsg,
$sendToLog,
$callerFunc );
}
/**
* Send a raw deprecation message to the log and the debug toolbar,
* without filtering of duplicate messages.
* without filtering of duplicate messages. A caller description will
* not be appended.
*
* @param string $msg The complete message including relevant caller information.
* @param bool $sendToLog If true, the message will be sent to the debug

View file

@ -79,10 +79,10 @@ class LocalFileDeleteBatch {
$suppress = $param4;
} else {
// Old signature
wfDeprecated(
__CLASS__ .
' being constructed without passing a user as the second parameter.' .
' See T245710 for more',
wfDeprecatedMsg(
'Construction of ' . __CLASS__ . ' without passing a user as ' .
'the second parameter was deprecated in MediaWiki 1.35. ' .
'See T245710 for more',
'1.35'
);

View file

@ -83,8 +83,9 @@ class HTMLInfoField extends HTMLFormField {
public function getOOUI( $value ) {
if ( !empty( $this->mParams['rawrow'] ) ) {
if ( !( $value instanceof OOUI\FieldLayout ) ) {
wfDeprecated( __METHOD__ . ": 'default' parameter as a string when using" .
"'rawrow' (must be a FieldLayout or subclass)", '1.32' );
wfDeprecatedMsg( __METHOD__ . ": 'default' parameter as a string when using " .
"'rawrow' was deprecated in MediaWiki 1.32 (must be a FieldLayout or subclass)",
'1.32' );
}
return $value;
}

View file

@ -47,8 +47,9 @@ class ParsoidVirtualRESTService extends VirtualRESTService {
public function __construct( array $params ) {
// for backwards compatibility:
if ( isset( $params['URL'] ) ) {
wfDeprecated(
'Using all-caps URL parameter to $wgVirtualRestConfig', '1.35'
wfDeprecatedMsg(
'Using all-caps URL parameter to $wgVirtualRestConfig ' .
'was deprecated in MediaWiki 1.35', '1.35'
);
$params['url'] = $params['URL'];
unset( $params['URL'] );

View file

@ -2329,7 +2329,8 @@ class Article implements Page {
* @return mixed
*/
public function __get( $fname ) {
wfDeprecated( __METHOD__ . " Access to raw $fname field", '1.35' );
wfDeprecatedMsg( "Accessing Article::\$$fname is deprecated since MediaWiki 1.35",
'1.35' );
if ( $fname === 'mRevision' ) {
$record = $this->fetchRevisionRecord(); // Ensure that it is loaded
@ -2352,7 +2353,8 @@ class Article implements Page {
* @param mixed $fvalue New value
*/
public function __set( $fname, $fvalue ) {
wfDeprecated( __METHOD__ . " Access to raw $fname field", '1.35' );
wfDeprecatedMsg( "Setting Article::\$$fname is deprecated since MediaWiki 1.35",
'1.35' );
if ( $fname === 'mRevision' ) {
$this->mRevisionRecord = $fvalue ?

View file

@ -2780,14 +2780,17 @@ class Parser {
$this->hookRunner->onParserGetVariableValueSwitch( $this,
$this->mVarCache, $index, $ret, $frame );
if ( $index !== $originalIndex ) {
wfDeprecated(
'ParserGetVariableValueSwitch modifying $index', '1.35'
wfDeprecatedMsg(
'A ParserGetVariableValueSwitch hook handler modified $index, ' .
'this is deprecated since MediaWiki 1.35',
'1.35', false, false
);
}
if ( !isset( $this->mVarCache[$originalIndex] ) ||
$this->mVarCache[$originalIndex] !== $ret ) {
wfDeprecated(
'ParserGetVariableValueSwitch bypassing cache', '1.35'
wfDeprecatedMsg(
'A ParserGetVariableValueSwitch hook handler bypassed the cache, ' .
'this is deprecated since MediaWiki 1.35', '1.35', false, false
);
}// FIXME: in the future, don't give this hook unrestricted
// access to mVarCache; we can cache it ourselves by falling

View file

@ -311,7 +311,7 @@ class ParserOptions {
*/
public function setTidy( $x ) {
if ( !$x ) {
wfDeprecated( 'disabling tidy', '1.33' );
wfDeprecatedMsg( 'Disabling tidy is deprecated since MediaWiki 1.33', '1.33' );
}
return $this->setOptionLegacy( 'tidy', $x );
}

View file

@ -445,7 +445,8 @@ class Sanitizer {
];
if ( $wgAllowImageTag ) {
wfDeprecated( 'Setting $wgAllowImageTag to true', '1.35' );
wfDeprecatedMsg( 'Setting $wgAllowImageTag to true ' .
'is deprecated since MediaWiki 1.35', '1.35', false, false );
$htmlsingle[] = 'img';
$htmlsingleonly[] = 'img';
}

View file

@ -348,9 +348,10 @@ class ExtensionRegistry {
}
if ( !isset( $info['manifest_version'] ) ) {
wfDeprecated(
"{$info['name']}'s extension.json or skin.json does not have manifest_version",
'1.29'
wfDeprecatedMsg(
"{$info['name']}'s extension.json or skin.json does not have manifest_version, " .
'this is deprecated since MediaWiki 1.29',
'1.29', false, false
);
$warnings = true;
// For backwards-compatibility, assume a version of 1

View file

@ -60,9 +60,10 @@ class DidYouMeanWidget {
// was only documented but not enforced previously emit a
// deprecation warning and in the future we can simply fail on bad
// inputs
wfDeprecated(
get_class( $resultSet ) . '::getQueryAfterRewriteSnippet returning empty snippet',
'1.34'
wfDeprecatedMsg(
get_class( $resultSet ) . '::getQueryAfterRewriteSnippet returning empty snippet ' .
'was deprecated in MediaWiki 1.35',
'1.34', false, false
);
$snippet = $resultSet->getQueryAfterRewrite();
}
@ -109,9 +110,10 @@ class DidYouMeanWidget {
// was only documented but not enforced previously emit a
// deprecation warning and in the future we can simply fail on bad
// inputs
wfDeprecated(
get_class( $resultSet ) . '::getSuggestionSnippet returning empty snippet',
'1.34'
wfDeprecatedMsg(
get_class( $resultSet ) . '::getSuggestionSnippet returning empty snippet ' .
'was deprecated in MediaWiki 1.35',
'1.34', false, false
);
$snippet = $resultSet->getSuggestionSnippet();
}

View file

@ -455,9 +455,10 @@ class SpecialPageFactory {
$rec = $specialPageList[$realName];
if ( $rec instanceof SpecialPage ) {
wfDeprecated(
"a SpecialPage instance (for $realName) in " .
'$wgSpecialPages or from the SpecialPage_initList hook',
wfDeprecatedMsg(
"A SpecialPage instance for $realName was found in " .
'$wgSpecialPages or came from a SpecialPage_initList hook handler, ' .
'this was deprecated in MediaWiki 1.34',
'1.34'
);

View file

@ -656,9 +656,9 @@ class SpecialContributions extends IncludableSpecialPage {
'section' => 'contribs-top',
];
wfDeprecated(
__METHOD__ .
' returning string[]',
'1.33'
'A SpecialContributions::getForm::filters hook handler returned ' .
'an array of strings, this is deprecated since MediaWiki 1.33',
'1.33', false, false
);
} else {
// Preferred append method.

View file

@ -414,7 +414,9 @@ class SpecialEmailUser extends UnlistedSpecialPage {
// Ugh. Either a raw HTML string, or something that's supposed
// to be treated like one.
$type = is_object( $error ) ? get_class( $error ) : gettype( $error );
wfDeprecated( "EmailUser hook returning a $type as \$error", '1.29' );
wfDeprecatedMsg( "An EmailUser hook returned a $type as \$error, " .
"this is deprecated since MediaWiki 1.29",
'1.29', false, false );
return Status::newFatal( new ApiRawMessage(
[ '$1', Message::rawParam( (string)$error ) ], 'hookaborted'
) );

View file

@ -378,8 +378,9 @@ class SpecialSearch extends SpecialPage {
$rewritten = $engine->replacePrefixes( $term );
if ( $rewritten !== $term ) {
wfDeprecated( 'SearchEngine::replacePrefixes() (overridden by ' .
get_class( $engine ) . ')', '1.32' );
wfDeprecatedMsg( 'SearchEngine::replacePrefixes() was overridden by ' .
get_class( $engine ) . ', this is deprecated since MediaWiki 1.32',
'1.32', false, false );
}
// fetch search results

View file

@ -161,7 +161,8 @@ class NamespaceInfo {
*/
public function isMovable( $index ) {
if ( !$this->options->get( 'AllowImageMoving' ) ) {
wfDeprecated( 'Setting $wgAllowImageMoving to false', '1.35' );
wfDeprecatedMsg( 'Setting $wgAllowImageMoving to false was deprecated in MediaWiki 1.35',
'1.35', false, false );
}
$result = $index >= NS_MAIN &&

View file

@ -97,13 +97,15 @@ class PasswordReset implements LoggerAwareInterface {
$this->permissionManager = $permissionManager;
if ( !$loadBalancer ) {
wfDeprecated( 'Not passing LoadBalancer to ' . __METHOD__, '1.34' );
wfDeprecatedMsg( 'Not passing LoadBalancer to ' . __METHOD__ .
' was deprecated in MediaWiki 1.34', '1.34' );
$loadBalancer = MediaWikiServices::getInstance()->getDBLoadBalancer();
}
$this->loadBalancer = $loadBalancer;
if ( !$logger ) {
wfDeprecated( 'Not passing LoggerInterface to ' . __METHOD__, '1.34' );
wfDeprecatedMsg( 'Not passing LoggerInterface to ' . __METHOD__ .
' was deprecated in MediaWiki 1.34', '1.34' );
$logger = LoggerFactory::getInstance( 'authentication' );
}
$this->logger = $logger;

View file

@ -1716,9 +1716,10 @@ class User implements IDBAccessObject, UserIdentity {
}
if ( $deprecatedIPEntries ) {
wfDeprecated(
'IP addresses in the keys of $wgProxyList (found the following IP addresses in keys: ' .
implode( ', ', $deprecatedIPEntries ) . ', please move them to values)', '1.30' );
wfDeprecatedMsg(
'Use of IP addresses in the keys of $wgProxyList is deprecated since MediaWiki 1.30. ' .
'Found the following IP addresses in keys: ' . implode( ', ', $deprecatedIPEntries ) .
', please move them to values.', '1.30', false, false );
}
$proxyListIPSet = new IPSet( $resultProxyList );

View file

@ -70,7 +70,9 @@ class Language {
*/
public function __get( string $name ) {
if ( $name == "mConverter" ) {
wfDeprecated( 'Language::mConverter', '1.35' );
wfDeprecatedMsg(
'Access to Language::$mConverter was deprecated in MediaWiki 1.35',
'1.35' );
return $this->getConverter();
}
throw new RuntimeException( "Cannot get '$name' property." );
@ -3036,14 +3038,14 @@ class Language {
protected function transformUsingPairFile( $file, $string, $basePath = null ) {
if ( isset( $this->transformData[$file] ) ) {
wfDeprecated(
__METHOD__ . ' structure of $transformData is changed',
'Modification of Language::$transformData is deprecated since MediaWiki 1.35',
'1.35'
);
return $this->transformData[$file]->replace( $string );
}
if ( $basePath === null ) {
wfDeprecated( __METHOD__ . ' $basePath is required', '1.35' );
wfDeprecated( __METHOD__ . ' without $basePath', '1.35' );
global $IP;
$basePath = $IP;
}

View file

@ -84,22 +84,31 @@ class TestFileReader {
$nonTidySection = $this->checkSection(
[ 'html/php+untidy', 'html+untidy' ], false );
if ( $this->format < 2 ) {
wfDeprecated( "parserTest v1: $this->file", '1.35' );
wfDeprecatedMsg(
"The parserTest v1 file format was deprecated in MediaWiki 1.35 " .
"(used in {$this->file})", '1.35', false, false );
if ( $nonTidySection === false ) {
// untidy by default
$nonTidySection = $output;
}
} else {
if ( $this->checkSection( [ 'input' ], false ) ) {
wfDeprecated( 'input section in parserTest', '1.35' );
wfDeprecatedMsg(
"The input section in parserTest files was deprecated in MediaWiki 1.35 " .
"(used in {$this->file})",
'1.35', false, false );
}
if ( $this->checkSection( [ 'result' ], false ) ) {
wfDeprecated( 'result section in parserTest', '1.35' );
wfDeprecatedMsg(
"The result section in parserTest files was deprecated in MediaWiki 1.35 " .
"(used in {$this->file})",
'1.35', false, false );
}
if ( $output && $tidySection ) {
wfDeprecated(
'untidy section should be renamed at ' .
"{$this->file}:{$this->sectionLineNum['test']}", '1.35'
wfDeprecatedMsg(
'The untidy section of parserTest files was deprecated in MediaWiki 1.35, ' .
"it should be renamed at {$this->file}:{$this->sectionLineNum['test']}",
'1.35', false, false
);
}
if ( $tidySection === false ) {
@ -109,7 +118,11 @@ class TestFileReader {
if ( $nonTidySection && !$tidySection ) {
// Tests with a "without tidy" section but no "with tidy" section
// are deprecated!
wfDeprecated( "test without tidy at {$this->file}:{$this->sectionLineNum['test']}", '1.35' );
wfDeprecatedMsg(
'Parser tests with a "without tidy" section but no "with tidy" ' .
' section were deprecated in MediaWiki 1.35. Found at ' .
"{$this->file}:{$this->sectionLineNum['test']}",
'1.35', false, false );
}
}
@ -169,7 +182,9 @@ class TestFileReader {
} else {
// We can no longer run the non-tidy test, and we don't have
// a tidy alternative.
wfDeprecated( 'skipping non-tidy test', '1.35' );
wfDeprecatedMsg( "Skipping non-tidy test {$data['test']} " .
"since it was removed in MediaWiki 1.35, and there is no tidy subtest",
'1.35', false, false );
}
} elseif ( $tidySection !== false ) {
// No need to override desc when there is no subtest

View file

@ -72,7 +72,7 @@ class MergeHistoryTest extends MediaWikiTestCase {
* @covers MergeHistory::isValidMerge
*/
public function testIsValidMergeRevisionLimit() {
$this->hideDeprecated( 'MergeHistory being constructed directly' );
$this->filterDeprecated( '/Direct construction of MergeHistory/' );
$limit = MergeHistory::REVISION_LIMIT;
@ -143,7 +143,7 @@ class MergeHistoryTest extends MediaWikiTestCase {
$timestamp = false;
// Old method: No dependencies injected
$this->hideDeprecated( 'MergeHistory being constructed directly' );
$this->filterDeprecated( '/Direct construction of MergeHistory/' );
$mergeHistory = new MergeHistory( $source, $destination, $timestamp );
$this->assertInstanceOf(
MergeHistory::class,

View file

@ -2183,7 +2183,7 @@ class OutputPageTest extends MediaWikiTestCase {
->will( $this->returnValue( $cookies ) );
TestingAccessWrapper::newFromObject( $op )->mVaryHeader = [];
$this->hideDeprecated( 'addVaryHeader $option is ignored' );
$this->filterDeprecated( '/The \$option parameter to addVaryHeader is ignored/' );
foreach ( $calls as $call ) {
$op->addVaryHeader( ...$call );
}

View file

@ -47,7 +47,7 @@ class MWLBFactoryTest extends MediaWikiTestCase {
'serverTemplate' => [],
];
$this->hideDeprecated( '$wgLBFactoryConf must be updated. See RELEASE-NOTES for details' );
$this->filterDeprecated( '/\$wgLBFactoryConf must be updated/' );
$result = MWLBFactory::getLBFactoryClass( $config );
$this->assertEquals( $expected, $result );

View file

@ -29,7 +29,7 @@ class ArticleTest extends \MediaWikiTestCase {
* @covers Article::__get
*/
public function testImplementsGetMagic() {
$this->hideDeprecated( 'Article::__get Access to raw mLatest field' );
$this->filterDeprecated( '/Accessing Article::\$mLatest/' );
$this->assertFalse( $this->article->mLatest, "Article __get magic" );
}
@ -38,8 +38,8 @@ class ArticleTest extends \MediaWikiTestCase {
* @covers Article::__set
*/
public function testImplementsSetMagic() {
$this->hideDeprecated( 'Article::__get Access to raw mLatest field' );
$this->hideDeprecated( 'Article::__set Access to raw mLatest field' );
$this->filterDeprecated( '/Accessing Article::\$mLatest/' );
$this->filterDeprecated( '/Setting Article::\$mLatest/' );
$this->article->mLatest = 2;
$this->assertEquals( 2, $this->article->mLatest, "Article __set magic" );
}
@ -49,11 +49,11 @@ class ArticleTest extends \MediaWikiTestCase {
* @covers Article::__set
*/
public function testGetOrSetOnNewProperty() {
$this->hideDeprecated(
'Article::__get Access to raw ext_someNewProperty field'
$this->filterDeprecated(
'/Accessing Article::\$ext_someNewProperty/'
);
$this->hideDeprecated(
'Article::__set Access to raw ext_someNewProperty field'
$this->filterDeprecated(
'/Setting Article::\$ext_someNewProperty/'
);
$this->article->ext_someNewProperty = 12;
$this->assertEquals( 12, $this->article->ext_someNewProperty,

View file

@ -123,7 +123,7 @@ class NamespaceInfoTest extends MediaWikiTestCase {
*/
public function testIsMovable( $expected, $ns, $allowImageMoving = true ) {
if ( $allowImageMoving === false ) {
$this->hideDeprecated( 'Setting $wgAllowImageMoving to false' );
$this->filterDeprecated( '/Setting \$wgAllowImageMoving to false/' );
}
$obj = $this->newObj( [ 'AllowImageMoving' => $allowImageMoving ] );