In T107174: Add an API action to just change content model I added a ContentModelChange class to be used by both Special:ChangeContentModel and the new api module. It currently has a PermissionManager injected, but calls on MediaWikiServices for a ContentHandlerFactory and RevisionLookup, and after the migration of hooks will use the HookContainer service.
I propose that the PageCommandFactory implement a new interface, ContentModelChangeFactory, to fully inject these dependencies.
Since the ContentModelChange class was only added in 1.35, breaking changes can be made
interface ContentModelChangeFactory { /** * @param User $user * @param WikiPage $wikipage * @param string $newModel * @return ContentModelChange */ public function newContentModelChange( User $user, WikiPage $wikipage, string $newModel ) : ContentModelChange; }