Page MenuHomePhabricator

Deprecated TitleArray and replace it with PageSelectQueryBuilder
Open, MediumPublic

Description

TitleArray is a utility for creating Title instances on the fly, based on a result set containing rows form the page table.

Instead of Title instances, we want to use PageIdentity or PageStoreRecord objects instead. A convenient way to construct such objects based on a result set is PageSelectQueryBuilder.

Replacing TitleArray with a functionally equivalent usages of PageSelectQueryBuilder is simple enough; However, TitleArray is often use as a return type hint:

> ack '@return TitleArray' includes/
includes/cache/BacklinkCache.php
172:	 * @return TitleArrayFromResult
521:	 * @return TitleArray

includes/Category.php
276:	 * @return TitleArray TitleArray object for category members.

includes/page/ImagePage.php
1180:	 * @return TitleArray|Title[]

includes/page/WikiFilePage.php
215:	 * @return TitleArray|Title[]

includes/page/WikiPage.php
3516:	 * @return TitleArray

includes/Title.php
3071:	 * @return TitleArray|array TitleArray, or empty array if this page's namespace

includes/TitleArray.php
40:	 * @return TitleArrayFromResult

A quick survey of callers indicates that we could probably change the return type to iterable<Title> without breaking anything. However, we really want to go to iterable<PageIdentity> or PageIdentity[], which probably means deprecating and replacing the relevant methods.