In the MediaWiki core classes that implement the Block interface, calls to MediaWikiServices::getInstance() should be avoided, for testability and architectural cleanliness.
Plans:
- New convenience factory methods in DatabaseBlockStore, for the benefit of the many DatabaseBlock::__construct() callers in tests.
- The DatabaseBlock constructor parameter expiry, which requires IDatabase for its interpretation, will be replaced by decodedExpiry. We could consider some other interpretation for expiry which doesn't depend on services, since any caller that is actually getting rows from the database should be using DatabaseBlockStore::newFromRow(), which already passes decodedExpiry to DatabaseBlock.
- The AbstractBlock constructor parameter address, which requires BlockUtils for its interpretation, will be replaced by target, which will be a BlockTarget object (T382106). The original parameter will still be available in a factory.
- Calling setTarget()with UserIdentity|string will be deprecated in favour of BlockTarget|null, to avoid a BlockUtils dependency.
- Already hard-deprecated: newFromID, newFromRow, delete, insert, update, isExemptedFromAutoblocks, doAutoblock, updateTimestamp, getAutoblockExpiry, newFromTarget, newListFromTarget and getBlocksForIPList
Problems without plans:
- appliesToRight needs config, BlockActionInfo and PermissionManager
- appliesToUsertalk needs config
- equals, setId and getRestrictions need BlockRestrictionStore
- setBlocker needs UserNameUtils
- setReason can take a Message parameter and formats it using CommentStoreComment::newUnsavedComment, which depends on services