Hard-deprecate ContentHandler::getContentText()

No remaining uses in WMF-deployed extensions. (Although there is a
similarly named but separate function in CiteThisPage.)

Bug: T268041
Change-Id: Iec68845c631758fe85d32a939b28b6d8b1243858
This commit is contained in:
Taavi Väänänen 2024-04-21 22:14:34 +03:00
parent e2fd40cb77
commit f28348d9c0
No known key found for this signature in database
GPG key ID: EF242F709F912FBE
3 changed files with 7 additions and 1 deletions

View file

@ -123,6 +123,8 @@ because of Phabricator reports.
* ISQLPlatform::tableNamesN() is now deprecated.
* The implementation in SQLPlatform of ISQLPlatform::tableNames(), deprecated in
MediaWiki 1.39, now emits deprecation warnings.
* ContentHandler::getContentText(), deprecated in 1.37, now emits deprecation
warnings.
* …
=== Other changes in 1.43 ===

View file

@ -89,12 +89,13 @@ abstract class ContentHandler {
* @since 1.21
*
* @deprecated since 1.37, use Content::getText() for TextContent instances
* instead
* instead. Hard deprecated since 1.43.
*
* @param Content|null $content
* @return string|null Textual form of the content, if available.
*/
public static function getContentText( Content $content = null ) {
wfDeprecated( __METHOD__, '1.37' );
if ( $content === null ) {
return '';
}

View file

@ -165,6 +165,7 @@ class ContentHandlerTest extends MediaWikiIntegrationTestCase {
* @covers \ContentHandler::getContentText
*/
public function testGetContentText_Null() {
$this->hideDeprecated( 'ContentHandler::getContentText' );
$content = null;
$text = ContentHandler::getContentText( $content );
$this->assertSame( '', $text );
@ -174,6 +175,7 @@ class ContentHandlerTest extends MediaWikiIntegrationTestCase {
* @covers \ContentHandler::getContentText
*/
public function testGetContentText_TextContent() {
$this->hideDeprecated( 'ContentHandler::getContentText' );
$content = new WikitextContent( "hello world" );
$text = ContentHandler::getContentText( $content );
$this->assertEquals( $content->getText(), $text );
@ -183,6 +185,7 @@ class ContentHandlerTest extends MediaWikiIntegrationTestCase {
* @covers \ContentHandler::getContentText
*/
public function testGetContentText_NonTextContent() {
$this->hideDeprecated( 'ContentHandler::getContentText' );
$content = new DummyContentForTesting( "hello world" );
$text = ContentHandler::getContentText( $content );
$this->assertNull( $text );