Merge "Make Title::getPageViewLanguage() emit deprecation warnings"

This commit is contained in:
jenkins-bot 2024-07-10 14:38:49 +00:00 committed by Gerrit Code Review
commit e193c68994
3 changed files with 4 additions and 0 deletions

View file

@ -407,6 +407,7 @@ because of Phabricator reports.
use RestrictionStore::getCreateProtection() instead.
* Title::loadRestrictions(), deprecated in 1.37, now emits warnings.
* Title::flushRestrictions(), deprecated in 1.37, now emits warnings.
* Title::getPageViewLanguage(), deprecated in 1.42, now emits warnings.
* The following methods, previously deprecated, now emit deprecation warnings:
- ContentHandler::getDefaultModelFor(), deprecated since 1.33
- ContentHandler::getAllContentFormats(), deprecated since 1.35

View file

@ -3610,10 +3610,12 @@ class Title implements Stringable, LinkTarget, PageIdentity {
* e.g. the user language (such as special pages).
*
* @deprecated since 1.42 Use ParserOutput::getLanguage instead. See also OutputPage::getContLangForJS.
* Hard-deprecated since 1.43.
* @since 1.20
* @return Language
*/
public function getPageViewLanguage() {
wfDeprecated( __METHOD__, '1.42' );
$services = MediaWikiServices::getInstance();
if ( $this->isSpecialPage() ) {

View file

@ -977,6 +977,7 @@ class TitleTest extends MediaWikiIntegrationTestCase {
$this->assertInstanceOf( Title::class, $title,
"Test must be passed a valid title text, you gave '$titleText'"
);
$this->hideDeprecated( Title::class . '::getPageViewLanguage' );
$this->assertEquals( $expected,
$title->getPageViewLanguage()->getCode(),
$msg