Title: Hard deprecate Title::newFromTitleValue()

I've updated callers to the deprecated code to use the new
method and we can completely remove the deprecated code in
mw 1.40

The deprecated method delegated to `::newFromLinkTarget()`
which is it's direct replacement, so that should be used
instead.

Depends-On: If799d6a1e722ca80f50b0f12c9b1c9f31a40a860
Depends-On: I276845ccf39ac7a65fca8ba268abbe1e02607a4b
Depends-On: I5d7213e9bcd84f5b674136d2d8b13577cbeead83
Depends-On: Idd222cc5ea94ee1215ab6d4c9e06d79c0a95d6aa
Change-Id: Ibc723aa30a2282222248669c3c195ecb7dfb2423
This commit is contained in:
Derick Alangi 2022-05-06 18:56:46 +01:00
parent e8142e2356
commit f749e04fb6
No known key found for this signature in database
GPG key ID: AF892C3FF0FC458E
4 changed files with 7 additions and 2 deletions

View file

@ -186,6 +186,8 @@ because of Phabricator reports.
the ::factory() method.
* Title::getSelectFields() has been deprecated in favor of
PageStore::newSelectQueryBuilder()
* Title::newFromTitleValue(), deprecated since in 1.34, now emits deprecation
warnings. Use ::newFromLinkTarget() instead.
* The following global functions are deprecated in favor of the listed UrlUtils
methods.
- wfExpandUrl -> UrlUtils::expand

View file

@ -254,7 +254,8 @@ class Title implements LinkTarget, PageIdentity, IDBAccessObject {
* unless $forceClone is "clone". If $forceClone is "clone" and the given TitleValue
* is already a Title instance, that instance is copied using the clone operator.
*
* @deprecated since 1.34, use newFromLinkTarget or castFromLinkTarget
* @deprecated since 1.34, use newFromLinkTarget or castFromLinkTarget. Hard
* deprecated in 1.39.
*
* @param TitleValue $titleValue Assumed to be safe.
* @param string $forceClone set to NEW_CLONE to ensure a fresh instance is returned.
@ -262,6 +263,7 @@ class Title implements LinkTarget, PageIdentity, IDBAccessObject {
* @return Title
*/
public static function newFromTitleValue( TitleValue $titleValue, $forceClone = '' ) {
wfDeprecated( __METHOD__, '1.34' );
return self::newFromLinkTarget( $titleValue, $forceClone );
}

View file

@ -157,7 +157,7 @@ class TrackingCategories {
}
// XXX: should be a better way to convert a TitleValue
// to a PageReference!
$tempTitle = Title::newFromTitleValue( $tempTitle );
$tempTitle = Title::newFromLinkTarget( $tempTitle );
$catName = $msgObj->page( $tempTitle )->text();
# Allow tracking categories to be disabled by setting them to "-"
if ( $catName !== '-' ) {

View file

@ -174,6 +174,7 @@ class TitleTest extends MediaWikiUnitTestCase {
* @dataProvider provideNewFromTitleValue
*/
public function testNewFromTitleValue( TitleValue $value ) {
$this->hideDeprecated( 'Title::newFromTitleValue' );
$title = Title::newFromTitleValue( $value );
$dbkey = str_replace( ' ', '_', $value->getText() );