Currently blocks and block restrictions are based on Title objects. They really don't need to - blocks only need pageId, dbkey and namespace, so the whole package can be moved to using PageIdentity.
Additionally, none of the block-related classes can be extended by extensions cause MW doesn't support custom block types, which means we can be quite cavalier with changing the types.
A few complications is that blocks do Title::newFrom* in a few places, however, they really don't need to:
- PageRestriction can be constructed via newFromRow, where row is a result of a left join on the page table on page_id, which means we can either instantiate a PageIdentityValue directly, right away, or the page table record with the given page ID doesn't exist, so retrying to instantiate a Title from the the same ID makes no sense.
- When constructing a log entry - that should remain, it's a boundary interface.
Proposal:
- Override constructor in PageRestriction constructor take ?PageIdentity. remove the $title filed, replace it with $page field.
- Change newFromRow to build up a PageIdentityValue instead of Title
- Deprecate PageRestriction::get/set Title, create PageRestriction::getPage():PageIdentity. No need to set one anymore.
- Adjust the rest of the code and mostly replace Title type hints with PageIdentity typegints - all should just fall into place.